fix: client reference prepare destination on ssr #29
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.
Hello! This is related to client reference preinit/preload we've been talking. For SSR prepare destination (which Parcel correctly implements),
(react-server-dom-xxx/client).createFromReadableStreamneeds to be triggered inside(react-dom/server).renderToReadableStream. There was a conversation onreact-server-dom-parcelPR facebook/react#31799 (comment)I just hacked around
decodeandrenderHtmlto verify this, but this probably means react router side needs to adjust howrouteRSCServerRequestworks. This feels like React side limitation, so probably they might find a way to avoid this gotcha, but just sharing it here in case you find it useful.Also I verified it on my Vite plugin example with the same hack hi-ogawa/vite-plugins#765 (but note that, in my case with
react-server-dom-webpack, I'm not using builtinchunkssystem, but rather callingReactDOM.preloadModulemanually during__webpack_require__https://github.com/hi-ogawa/vite-plugins/blob/2bf1040130352cab6ce6d47107fbd477637b8447/packages/rsc/src/ssr.ts#L11-L39).How to verify