dillon1000/react
Commit
Browse files [Flight] Don't serialize toJSON in Debug path and omit wide arrays (#34759)
There's a couple of issues with serializing Buffer in the debug renders. For one, the Node.js Buffer has a `toJSON` on it which turns the binary data into a JSON array which is very inefficient to serialize compared to the real buffer. For debug info we never really want to resolve these and unlike the regular render we can't error. So this uses the trick where we read the original value. It's still unfortunate that this intermediate gets created at all but at least now we're not serializing it. Second, we have a limit on depth of objects but we didn't have a limit on width like large arrays or typed arrays. This omits large arrays from the payload when possible and make them deferred when there's a debug channel.
Changed paths3 files
First-parent comparisonpackages/react-server/src/ReactFlightServer.js ModifiedM packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js ModifiedA packages/react-server/src/__tests__/test-file.txt AddedPatch
Files changed
Rendering syntax-highlighted changes…