Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fizz/Flight] Pass in Destination lazily to startFlowing instead of in createRequest #22449

Merged
merged 4 commits into from
Sep 28, 2021

Conversation

sebmarkbage
Copy link
Collaborator

@sebmarkbage sebmarkbage commented Sep 28, 2021

We don't really need the destination while we can't write to it anyway. So we can accept it lazily and reset it when we stop flowing.

This cleans up some of the cyclic dependencies in creating browser streams. However, my main motivation is that I plan on changing the Node API to lazily accept a stream.

In the future we might enable multiple destinations to be added after the fact. So you can use the same request for both a live stream and a buffered cached stream with different ordered results.

cc @devknoll @wardpeet

@facebook-github-bot facebook-github-bot added the React Core Team Opened by a member of the React Core Team label Sep 28, 2021
@sizebot
Copy link

sizebot commented Sep 28, 2021

Comparing: eba248c...2c8ffd1

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 130.40 kB 130.40 kB = 41.53 kB 41.53 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 133.23 kB 133.23 kB = 42.48 kB 42.48 kB
facebook-www/ReactDOM-prod.classic.js = 413.15 kB 413.15 kB = 76.35 kB 76.35 kB
facebook-www/ReactDOM-prod.modern.js = 401.78 kB 401.78 kB = 74.64 kB 74.64 kB
facebook-www/ReactDOMForked-prod.classic.js = 413.15 kB 413.15 kB = 76.35 kB 76.35 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.production.min.server.js +2.85% 6.66 kB 6.85 kB +2.09% 2.78 kB 2.84 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.production.min.server.js +2.85% 6.66 kB 6.85 kB +2.09% 2.78 kB 2.84 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.production.min.server.js +2.85% 6.66 kB 6.85 kB +2.09% 2.78 kB 2.84 kB
oss-experimental/react-server/cjs/react-server-flight.production.min.js +2.79% 6.80 kB 6.99 kB +2.06% 2.86 kB 2.92 kB
oss-stable-semver/react-server/cjs/react-server-flight.production.min.js +2.79% 6.80 kB 6.99 kB +2.06% 2.86 kB 2.92 kB
oss-stable/react-server/cjs/react-server-flight.production.min.js +2.79% 6.80 kB 6.99 kB +2.06% 2.86 kB 2.92 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js +2.68% 6.61 kB 6.79 kB +1.83% 2.79 kB 2.84 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js +2.68% 6.61 kB 6.79 kB +1.83% 2.79 kB 2.84 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js +2.68% 6.61 kB 6.79 kB +1.83% 2.79 kB 2.84 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.production.min.server.js +2.65% 6.83 kB 7.01 kB +1.84% 2.88 kB 2.93 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.production.min.server.js +2.65% 6.83 kB 7.01 kB +1.84% 2.88 kB 2.93 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.production.min.server.js +2.65% 6.83 kB 7.01 kB +1.84% 2.88 kB 2.93 kB
facebook-relay/flight/ReactFlightNativeRelayServer-prod.js +2.20% 15.39 kB 15.73 kB +1.94% 4.02 kB 4.10 kB
facebook-www/ReactFlightDOMRelayServer-prod.classic.js +2.20% 14.96 kB 15.28 kB +1.79% 3.91 kB 3.98 kB
facebook-www/ReactFlightDOMRelayServer-prod.modern.js +2.20% 14.96 kB 15.28 kB +1.79% 3.91 kB 3.98 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.production.min.server.js +2.85% 6.66 kB 6.85 kB +2.09% 2.78 kB 2.84 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.production.min.server.js +2.85% 6.66 kB 6.85 kB +2.09% 2.78 kB 2.84 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.production.min.server.js +2.85% 6.66 kB 6.85 kB +2.09% 2.78 kB 2.84 kB
oss-experimental/react-server/cjs/react-server-flight.production.min.js +2.79% 6.80 kB 6.99 kB +2.06% 2.86 kB 2.92 kB
oss-stable-semver/react-server/cjs/react-server-flight.production.min.js +2.79% 6.80 kB 6.99 kB +2.06% 2.86 kB 2.92 kB
oss-stable/react-server/cjs/react-server-flight.production.min.js +2.79% 6.80 kB 6.99 kB +2.06% 2.86 kB 2.92 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js +2.68% 6.61 kB 6.79 kB +1.83% 2.79 kB 2.84 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js +2.68% 6.61 kB 6.79 kB +1.83% 2.79 kB 2.84 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js +2.68% 6.61 kB 6.79 kB +1.83% 2.79 kB 2.84 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.production.min.server.js +2.65% 6.83 kB 7.01 kB +1.84% 2.88 kB 2.93 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.production.min.server.js +2.65% 6.83 kB 7.01 kB +1.84% 2.88 kB 2.93 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.production.min.server.js +2.65% 6.83 kB 7.01 kB +1.84% 2.88 kB 2.93 kB
facebook-relay/flight/ReactFlightNativeRelayServer-prod.js +2.20% 15.39 kB 15.73 kB +1.94% 4.02 kB 4.10 kB
facebook-www/ReactFlightDOMRelayServer-prod.classic.js +2.20% 14.96 kB 15.28 kB +1.79% 3.91 kB 3.98 kB
facebook-www/ReactFlightDOMRelayServer-prod.modern.js +2.20% 14.96 kB 15.28 kB +1.79% 3.91 kB 3.98 kB
facebook-relay/flight/ReactFlightNativeRelayServer-dev.js +1.61% 27.72 kB 28.16 kB +1.29% 7.27 kB 7.37 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.development.server.js +1.60% 27.77 kB 28.21 kB +1.24% 7.42 kB 7.51 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.development.server.js +1.60% 27.77 kB 28.21 kB +1.24% 7.42 kB 7.51 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.development.server.js +1.60% 27.77 kB 28.21 kB +1.24% 7.42 kB 7.51 kB
facebook-www/ReactFlightDOMRelayServer-dev.classic.js +1.58% 27.91 kB 28.35 kB +1.25% 7.21 kB 7.30 kB
facebook-www/ReactFlightDOMRelayServer-dev.modern.js +1.58% 27.91 kB 28.35 kB +1.25% 7.21 kB 7.30 kB
oss-experimental/react-server/cjs/react-server-flight.development.js +1.58% 27.34 kB 27.77 kB +1.22% 7.30 kB 7.39 kB
oss-stable-semver/react-server/cjs/react-server-flight.development.js +1.58% 27.34 kB 27.77 kB +1.22% 7.30 kB 7.39 kB
oss-stable/react-server/cjs/react-server-flight.development.js +1.58% 27.34 kB 27.77 kB +1.22% 7.30 kB 7.39 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.development.server.js +1.51% 29.65 kB 30.10 kB +1.19% 7.73 kB 7.83 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.development.server.js +1.51% 29.65 kB 30.10 kB +1.19% 7.73 kB 7.83 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.development.server.js +1.51% 29.65 kB 30.10 kB +1.19% 7.73 kB 7.83 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js +1.49% 27.91 kB 28.32 kB +1.20% 7.59 kB 7.68 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js +1.49% 27.91 kB 28.32 kB +1.20% 7.59 kB 7.68 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js +1.49% 27.91 kB 28.32 kB +1.20% 7.59 kB 7.68 kB
oss-stable-semver/react-server/cjs/react-server.production.min.js +1.27% 16.86 kB 17.08 kB +0.87% 5.84 kB 5.89 kB
oss-stable/react-server/cjs/react-server.production.min.js +1.27% 16.86 kB 17.08 kB +0.87% 5.84 kB 5.89 kB
oss-experimental/react-server/cjs/react-server.production.min.js +1.27% 16.99 kB 17.20 kB +0.85% 5.88 kB 5.93 kB
oss-stable-semver/react-dom/umd/react-dom-server.browser.production.min.js +0.92% 31.19 kB 31.47 kB +0.91% 10.68 kB 10.78 kB
oss-stable/react-dom/umd/react-dom-server.browser.production.min.js +0.92% 31.19 kB 31.47 kB +0.91% 10.68 kB 10.78 kB
oss-experimental/react-dom/umd/react-dom-server.browser.production.min.js +0.91% 31.32 kB 31.61 kB +0.94% 10.73 kB 10.83 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.production.min.js +0.89% 31.02 kB 31.30 kB +0.82% 10.57 kB 10.66 kB
oss-stable/react-dom/cjs/react-dom-server.browser.production.min.js +0.89% 31.02 kB 31.30 kB +0.82% 10.57 kB 10.66 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.production.min.js +0.89% 31.16 kB 31.43 kB +0.84% 10.62 kB 10.71 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.production.min.js +0.73% 31.61 kB 31.84 kB +0.59% 10.57 kB 10.63 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.production.min.js +0.73% 31.48 kB 31.71 kB +0.61% 10.51 kB 10.57 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.production.min.js +0.73% 31.48 kB 31.71 kB +0.61% 10.51 kB 10.57 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +0.73% 31.02 kB 31.24 kB +0.59% 10.35 kB 10.41 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +0.73% 30.88 kB 31.11 kB +0.63% 10.30 kB 10.36 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +0.73% 30.88 kB 31.11 kB +0.63% 10.30 kB 10.36 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.production.min.js +0.72% 31.31 kB 31.53 kB +0.73% 10.58 kB 10.66 kB
oss-stable/react-dom/cjs/react-dom-server.node.production.min.js +0.72% 31.31 kB 31.53 kB +0.73% 10.58 kB 10.66 kB
oss-experimental/react-dom/cjs/react-dom-server.node.production.min.js +0.72% 31.44 kB 31.67 kB +0.72% 10.64 kB 10.72 kB
oss-experimental/react-dom/umd/react-dom-server-legacy.browser.production.min.js +0.72% 31.21 kB 31.44 kB +0.63% 10.48 kB 10.54 kB
oss-stable-semver/react-dom/umd/react-dom-server-legacy.browser.production.min.js +0.72% 31.08 kB 31.30 kB +0.64% 10.43 kB 10.49 kB
oss-stable/react-dom/umd/react-dom-server-legacy.browser.production.min.js +0.72% 31.08 kB 31.30 kB +0.64% 10.43 kB 10.49 kB
facebook-www/ReactDOMServer-prod.modern.js +0.71% 67.92 kB 68.41 kB +0.71% 14.25 kB 14.35 kB
oss-stable-semver/react-server/cjs/react-server.development.js +0.30% 115.56 kB 115.91 kB +0.11% 28.43 kB 28.46 kB
oss-stable/react-server/cjs/react-server.development.js +0.30% 115.56 kB 115.91 kB +0.11% 28.43 kB 28.46 kB
oss-experimental/react-server/cjs/react-server.development.js +0.30% 116.12 kB 116.47 kB +0.12% 28.58 kB 28.61 kB

Generated by 🚫 dangerJS against 2c8ffd1

@sebmarkbage sebmarkbage merged commit 7843b14 into facebook:main Sep 28, 2021
facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Oct 12, 2021
Summary:
This sync includes the following changes:
- **[579c008a7](facebook/react@579c008a7 )**: [Fizz/Flight] pipeToNodeWritable(..., writable).startWriting() -> renderToPipeableStream(...).pipe(writable) ([#22450](facebook/react#22450)) //<Sebastian Markbåge>//
- **[f2c381131](facebook/react@f2c381131 )**: fix: useSyncExternalStoreExtra ([#22500](facebook/react#22500)) //<Daishi Kato>//
- **[0ecbbe142](facebook/react@0ecbbe142 )**: Sync hydrate discrete events in capture phase and dont replay discrete events ([#22448](facebook/react#22448)) //<salazarm>//
- **[a724a3b57](facebook/react@a724a3b57 )**: [RFC] Codemod invariant -> throw new Error ([#22435](facebook/react#22435)) //<Andrew Clark>//
- **[201af81b0](facebook/react@201af81b0 )**: Release pooled cache reference in complete/unwind ([#22464](facebook/react#22464)) //<Joseph Savona>//
- **[033efe731](facebook/react@033efe731 )**: Call get snapshot in useSyncExternalStore server shim ([#22453](facebook/react#22453)) //<salazarm>//
- **[7843b142a](facebook/react@7843b142a )**: [Fizz/Flight] Pass in Destination lazily to startFlowing instead of in createRequest ([#22449](facebook/react#22449)) //<Sebastian Markbåge>//
- **[d9fb383d6](facebook/react@d9fb383d6 )**: Extract queueing logic into shared functions ([#22452](facebook/react#22452)) //<Andrew Clark>//
- **[9175f4d15](facebook/react@9175f4d15 )**: Scheduling Profiler: Show Suspense resource .displayName ([#22451](facebook/react#22451)) //<Brian Vaughn>//
- **[eba248c39](facebook/react@eba248c39 )**: [Fizz/Flight] Remove reentrancy hack ([#22446](facebook/react#22446)) //<Sebastian Markbåge>//
- **[66388150e](facebook/react@66388150e )**: Remove usereducer eager bailout ([#22445](facebook/react#22445)) //<Joseph Savona>//
- **[d3e086932](facebook/react@d3e086932 )**: Make root.unmount() synchronous  ([#22444](facebook/react#22444)) //<Andrew Clark>//
- **[2cc6d79c9](facebook/react@2cc6d79c9 )**: Rename onReadyToStream to onCompleteShell ([#22443](facebook/react#22443)) //<Sebastian Markbåge>//
- **[c88fb49d3](facebook/react@c88fb49d3 )**: Improve DEV errors if string coercion throws (Temporal.*, Symbol, etc.) ([#22064](facebook/react#22064)) //<Justin Grant>//
- **[05726d72c](facebook/react@05726d72c )**: [Fix] Errors should not "unsuspend" a transition ([#22423](facebook/react#22423)) //<Andrew Clark>//
- **[3746eaf98](facebook/react@3746eaf98 )**: Packages/React/src/ReactLazy ---> changing -1 to unintialized ([#22421](facebook/react#22421)) //<BIKI DAS>//
- **[04ccc01d9](facebook/react@04ccc01d9 )**: Hydration errors should force a client render ([#22416](facebook/react#22416)) //<Andrew Clark>//
- **[029fdcebb](facebook/react@029fdcebb )**: root.hydrate -> root.isDehydrated ([#22420](facebook/react#22420)) //<Andrew Clark>//
- **[af87f5a83](facebook/react@af87f5a83 )**: Scheduling Profiler marks should include thrown Errors ([#22417](facebook/react#22417)) //<Brian Vaughn>//
- **[d47339ea3](facebook/react@d47339ea3 )**: [Fizz] Remove assignID mechanism ([#22410](facebook/react#22410)) //<Sebastian Markbåge>//
- **[3a50d9557](facebook/react@3a50d9557 )**: Never attach ping listeners in legacy Suspense ([#22407](facebook/react#22407)) //<Andrew Clark>//
- **[82c8fa90b](facebook/react@82c8fa90b )**: Add back useMutableSource temporarily ([#22396](facebook/react#22396)) //<Andrew Clark>//
- **[5b57bc6e3](facebook/react@5b57bc6e3 )**: [Draft] don't patch console during first render ([#22308](facebook/react#22308)) //<Luna Ruan>//
- **[cf07c3df1](facebook/react@cf07c3df1 )**: Delete all but one `build2` reference ([#22391](facebook/react#22391)) //<Andrew Clark>//
- **[bb0d06935](facebook/react@bb0d06935 )**: [build2 -> build] Local scripts //<Andrew Clark>//
- **[0c81d347b](facebook/react@0c81d347b )**: Write artifacts to `build` instead of `build2` //<Andrew Clark>//
- **[4da03c9fb](facebook/react@4da03c9fb )**: useSyncExternalStore React Native version ([#22367](facebook/react#22367)) //<salazarm>//
- **[48d475c9e](facebook/react@48d475c9e )**: correct typos ([#22294](facebook/react#22294)) //<Bowen>//
- **[cb6c619c0](facebook/react@cb6c619c0 )**: Remove Fiber fields that were used for hydrating useMutableSource ([#22368](facebook/react#22368)) //<Sebastian Silbermann>//
- **[64e70f82e](facebook/react@64e70f82e )**: [Fizz] add avoidThisFallback support ([#22318](facebook/react#22318)) //<salazarm>//
- **[3ee7a004e](facebook/react@3ee7a004e )**: devtools: Display actual ReactDOM API name in root type ([#22363](facebook/react#22363)) //<Sebastian Silbermann>//
- **[79b8fc667](facebook/react@79b8fc667 )**: Implement getServerSnapshot in userspace shim ([#22359](facebook/react#22359)) //<Andrew Clark>//
- **[86b3e2461](facebook/react@86b3e2461 )**: Implement useSyncExternalStore on server ([#22347](facebook/react#22347)) //<Andrew Clark>//
- **[8209de269](facebook/react@8209de269 )**: Delete useMutableSource implementation ([#22292](facebook/react#22292)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions e8feb11...afcb9cd

jest_e2e[run_all_tests]

Reviewed By: yungsters

Differential Revision: D31541359

fbshipit-source-id: c35941bc303fdf55cb061e9996200dc868a6f2af
zhengjitf pushed a commit to zhengjitf/react that referenced this pull request Apr 15, 2022
…n createRequest (facebook#22449)

* Pass in Destination lazily in startFlowing instead of createRequest

* Delay fatal errors until we have a destination to forward them to

* Flow can now be inferred by whether there's a destination set

We can drop the destination when we're not flowing since there's nothing to
write to.

Fatal errors now close once flowing starts back up again.

* Defer fatal errors in Flight too
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants