feat: add experimentalPostpone prop to Router for pathless SSR#162
Merged
feat: add experimentalPostpone prop to Router for pathless SSR#162
Conversation
During pathless SSR, <Outlet /> renders null when no child route matches (because there is no URL to match against), which causes hydration mismatches when the client renders the actual route content. Add an `experimentalPostpone` prop to Router that enables React's experimental `unstable_postpone()` API. When enabled, Outlet calls postpone() instead of rendering null during pathless SSR, telling React to defer that content to client-side rendering. This requires React Canary or experimental builds. https://claude.ai/code/session_01WzZWbDcL9vm9ef5hHXMtB1
The experimentalPostpone feature requires React's unstable_postpone API which is only available in React Canary builds. https://claude.ai/code/session_01WzZWbDcL9vm9ef5hHXMtB1
The canary react-dom from the pathless SSR example was getting hoisted and resolved by the router package's tests, causing a version mismatch error. Pin react-dom explicitly to prevent this. https://claude.ai/code/session_01WzZWbDcL9vm9ef5hHXMtB1
The router workspace package resolves react@19.2.4 (its own devDep) while the example uses React Canary. Without resolve.dedupe, Vite loads two React instances during the SSR build, causing a "Cannot read properties of null" error on hooks. https://claude.ai/code/session_01WzZWbDcL9vm9ef5hHXMtB1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
During pathless SSR, renders null when no child route matches
(because there is no URL to match against), which causes hydration
mismatches when the client renders the actual route content.
Add an
experimentalPostponeprop to Router that enables React'sexperimental
unstable_postpone()API. When enabled, Outlet callspostpone() instead of rendering null during pathless SSR, telling React
to defer that content to client-side rendering.
This requires React Canary or experimental builds.
https://claude.ai/code/session_01WzZWbDcL9vm9ef5hHXMtB1