dillon1000/react
Commit
Browse files [Flight] Serialize Server Components Props in DEV (#31105)
This allows us to show props in React DevTools when inspecting a Server Component. I currently drastically limit the object depth that's serialized since this is very implicit and you can have heavy objects on the server. We previously was using the general outlineModel to outline ReactComponentInfo but we weren't consistently using it everywhere which could cause some bugs with the parsing when it got deduped on the client. It also lead to the weird feature detect of `isReactComponent`. It also meant that this serialization was using the plain serialization instead of `renderConsoleValue` which means we couldn't safely serialize arbitrary debug info that isn't serializable there. So the main change here is to call `outlineComponentInfo` and have that always write every "Server Component" instance as outlined and in a way that lets its props be serialized using `renderConsoleValue`. <img width="1150" alt="Screenshot 2024-10-01 at 1 25 05 AM" src="https://github.com/user-attachments/assets/f6e7811d-51a3-46b9-bbe0-1b8276849ed4">
Changed paths7 files
First-parent comparisonpackages/react-client/src/ReactFlightClient.js ModifiedM packages/react-client/src/__tests__/ReactFlight-test.js ModifiedM packages/react-devtools-shared/src/backend/fiber/renderer.js ModifiedM packages/react-devtools-shared/src/hydration.js ModifiedM packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMBrowser-test.js ModifiedM packages/react-server/src/ReactFlightServer.js ModifiedM packages/shared/ReactTypes.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…