-
Notifications
You must be signed in to change notification settings - Fork 49.5k
Closed
Labels
Status: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bug
Description
React version: 18.1.0
Steps To Reproduce
- Set up a ContextProvider and pass object as value (not-memoized)
- Wrap the ContextProvider around a Suspense boundary
- In a component, outside of the Suspense boundary, update the context value inside of a useEffect
- Notice that the de-hydrated suspense content rendered by the server now switches back to the fallback on the client
Link to code example:
https://codesandbox.io/s/react-18-redux-ssr-forked-rbkvtv?file=/src/App.js (forked from a redux ssr sandbox bc I originally thought this was a hydration issue with redux)
The current behavior
The update to the context provider causes the suspense boundary to switch to the fallback since it has not finished hydrating yet and shows this error:
The expected behavior
The suspense boundary is able to hydrate without switching to the fallback on the client.
Note
Updating the ContextProvider to memoize the value using useMemo
addresses the issue but I am still curious if this is expected behavior or a bug.
gurkerl83, OliverJAsh, jtwjs, manafire, dstepp-indeed and 2 more
Metadata
Metadata
Assignees
Labels
Status: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bug