react/packages/react-server-dom-webpack
Sebastian Markbåge 9d111ffdfb
Serialize Promises through Flight (#26086)
This lets you pass Promises from server components to client components
and `use()` them there.

We still don't support Promises as children on the client, so we need to
support both. This will be a lot simpler when we remove the need to
encode children as lazy since we don't need the lazy encoding anymore
then.

I noticed that this test failed because we don't synchronously resolve
instrumented Promises if they're lazy. The second fix calls `.then()`
early to ensure that this lazy initialization can happen eagerly. ~It
felt silly to do this with an empty function or something, so I just did
the attachment of ping listeners early here. It's also a little silly
since they will ping the currently running render for no reason if it's
synchronously available.~ EDIT: That didn't work because a ping might
interrupt the current render. Probably need a bigger refactor.

We could add another extension but we've already taken a lot of
liberties with the Promise protocol. At least this is one that doesn't
need extension of the protocol as much. Any sub-class of promises could
do this.
2023-02-01 12:56:53 -05:00
..
esm [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
npm [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
src Serialize Promises through Flight (#26086) 2023-02-01 12:56:53 -05:00
README.md [Flight] Rename react-transport-... packages to react-server-... (#20403) 2020-12-08 08:08:57 -05:00
client.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
index.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
node-register.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
package.json Update cache() and use() to the canary aka next channel (#25502) 2022-10-23 23:20:52 -04:00
plugin.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
server.browser.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
server.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
server.node.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00

README.md

react-server-dom-webpack

Experimental React Flight bindings for DOM using Webpack.

Use it at your own risk.