GLTFLoader callbacks not set in useLoader #2881
Unanswered
jellyedwards
asked this question in
Q&A
Replies: 1 comment
-
this is not how it works, the api you're trying to call doesn't exist in threejs. https://threejs.org/docs/index.html?q=gltflo#examples/en/loaders/GLTFLoader all of this is taken care of by react suspense for you, if something really fails you end up in an error boundary, if you set one. useLoader gives you access to onprogress and the onerror is filled out and will throw (into the error bound). i use this package btw https://www.npmjs.com/package/react-error-boundary |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
If I use
useLoader
and pass in a function to manipulate the loader, it doesn't seem to work.Context:
I'm trying to gracefully handle when a gltf load fails, I was hoping to use the GLTFLoader callbacks but no luck. I tried
ErrorBoundary
as discussed here (#1881) but it didn't catch gracefully (I think because it's async?). I also tried wrapping in atry/catch
from the same discussion but the render doesn't update and the model isn't shown even when the glb exists.Repro: https://codesandbox.io/s/gltfloader-loading-forked-t9v110?file=/src/App.js
Beta Was this translation helpful? Give feedback.
All reactions