Unexpected behaviour with Suspense, Outlet and React.use() #12773
Unanswered
luisdlopez
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm oversimplifying the code but I think you'll get the idea. I can provide more information if needed.
I have a root that looks like the following:
In one of my route modules, I am using the clientLoader to return a promise (from a fetch that, for this example, will take some seconds to resolve). Then, the Component gets the loaderData, and inside of, I call the data using React.use() to trigger the Suspense fallback while we wait for the data, like so:
Now, when navigating from any page to this one, the fallback is not showing, even though React.use() is working as expected (and of course, this all works on the first load - but here, we are not dealing with any stale data or anything like that).
To give you another example, if I change MyComponent to include an additional Suspense, the whole thing works:
The fallback properly shows while the promise is resolved.
Is this normal? Shouldn't the Suspense around the Outlet catch this?
Beta Was this translation helpful? Give feedback.
All reactions