Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(useLoader): loosen Loader onError signature #3011

Merged
merged 1 commit into from
Sep 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/fiber/src/core/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface Loader<T> extends THREE.Loader {
url: string,
onLoad?: (result: T) => void,
onProgress?: (event: ProgressEvent) => void,
onError?: (event: ErrorEvent) => void,
onError?: (event: unknown) => void,
): unknown
loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<T>
}
Expand Down Expand Up @@ -101,12 +101,12 @@ function loadingFn<L extends LoaderProto<any>>(
new Promise((res, reject) =>
loader.load(
input,
(data: any) => {
(data) => {
if (data.scene) Object.assign(data, buildGraph(data.scene))
res(data)
},
onProgress,
(error) => reject(new Error(`Could not load ${input}: ${error.message}`)),
(error) => reject(new Error(`Could not load ${input}: ${(error as ErrorEvent)?.message}`)),
),
),
),
Expand Down