suspend-react
suspend-react copied to clipboard
Strong return type when passing a bare Promise; return promise from preload
Hi! Very good and wonderful library, I made some changes to suit my project, maybe they're helpful?
- Return type is now inferred when passing a bare Promise
-
preload
now returns the cached Promise, so you can know when preloading is done
I would love to see the second change in particular propagate out to @react-three/fiber's useLoader
, drei's useTexture
etc! It allows more strategic preloading of assets (wait for high-priority assets to load before loading others).
This works in my project but I definitely haven't tested it exhaustively.