dillon1000/react

Commit

[Flight] Serialize already resolved Promises as debug models (#33588)

We already support serializing the values of instrumented Promises as
debug values such as in console logs. However, we don't support plain
native promises.

This waits a microtask to see if we can read the value within a
microtask and if so emit it. This is so that we can still close the
connection.

Otherwise, we emit a "halted" row into its row id which replaces the old
"Infinite Promise" reference.

We could potentially wait until the end of the render before cancelling
so that if it resolves before we exit we can still include its value but
that would require a bit more work. Ideally we'd have a way to get these
lazily later anyway.
Browse files
Changed paths4 files
First-parent comparison
M packages/react-client/src/ReactFlightClient.js ModifiedM packages/react-client/src/__tests__/ReactFlight-test.js ModifiedM packages/react-noop-renderer/src/ReactNoopFlightClient.js ModifiedM packages/react-server/src/ReactFlightServer.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…