Suspense doesn't seem to work with ContextProvider
hey, so recently I noticed,
If I use
createResource(fetch)
and then put <Suspense fallback={<Placeholder>}>
I will see the placeholder during loading.
But if I have createResource(fetch)
inside a ContextProvider, i.e.:
and then have a
then I will not see the suspense-placeholder and in fact my UI will not update until the data is loaded.
Does suspense & createResource
not work around context-provide and use
?3 Replies
it seems the provider finished already before my screen is available, and the view just took a long time to layout in the CPU.
Thats why It seemed like it should have shown the loading-placeholder
In the code above, you aren't reading the resource. You have to do
data()
I believe the resource looks for the nearest suspense boundary to where it is readsorry, yeah that was simplified sample code as I didn't want to distract from the issue with the details.