dillon1000/react

Commit

experimental_use(promise) for Server Components (#25207)

Follow up to #25084. Implements experimental_use(promise) API in 
the Server Components runtime (Flight).

The implementation is much simpler than in Fiber because there is no
state. Even the "state" added in this PR — to track the result of each
promise across attempts — is reset as soon as a component 
successfully renders without suspending.

There are also fewer caveats around neglecting to cache a promise
because the state of the promises is preserved even if we switch to a
different task.

Server Components is the primary runtime where this API is intended to
be used.

The last runtime where we need to implement this is the server renderer
(Fizz).
Browse files
Changed paths7 files
First-parent comparison
M packages/react-reconciler/src/ReactFiberWakeable.new.js ModifiedM packages/react-reconciler/src/ReactFiberWakeable.old.js ModifiedM packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMBrowser-test.js ModifiedM packages/react-server/src/ReactFlightHooks.js ModifiedM packages/react-server/src/ReactFlightServer.js ModifiedA packages/react-server/src/ReactFlightWakeable.js AddedM packages/react/src/ReactSharedSubset.experimental.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…