Skip to content
Discussion options

You must be logged in to vote

the idea is that instead of doing this work in useEffect which just creates a lag next frame once the model has already loaded you suspend the component until everything's done. the drawback is that at that point the component has not rendered so there is no view and nothing's been added to the scene. but if you found a way to precompile a texture then you do something along the lines of this:

import { useAsset } from "use-assets"

function Foo() {
  const material = use???(???)
  useAsset(() => {
    precompile(material)
  }, [material])
  ...

<Suspense fallback={...}>
  <Foo />
</Suspense>

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@mattrossman
Comment options

Comment options

You must be logged in to vote
3 replies
@drcmda
Comment options

@drcmda
Comment options

@mattrossman
Comment options

Answer selected by mattrossman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants