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

[Flight] model halted references explicitly #30731

Merged
merged 1 commit into from
Aug 19, 2024

Conversation

gnoff
Copy link
Collaborator

@gnoff gnoff commented Aug 17, 2024

using infinitely suspending promises isn't right because this will parse as a promise which is only appropriate if the value we're halting at is a promise. Instead we need to have a special marker type that says this reference will never resolve. Additionally flight client needs to not error any halted references when the stream closes because they will otherwise appear as an error

addresses: #30705 (comment)

Copy link

vercel bot commented Aug 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 19, 2024 5:30pm

@gnoff gnoff requested a review from sebmarkbage August 17, 2024 02:01
@facebook-github-bot facebook-github-bot added the React Core Team Opened by a member of the React Core Team label Aug 17, 2024
@react-sizebot
Copy link

react-sizebot commented Aug 17, 2024

Comparing: 6ebfd5b...4e4e2f9

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.js = 6.68 kB 6.68 kB = 1.83 kB 1.82 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 500.37 kB 500.37 kB = 89.80 kB 89.80 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 507.50 kB 507.50 kB = 90.96 kB 90.96 kB
facebook-www/ReactDOM-prod.classic.js = 595.24 kB 595.24 kB = 105.55 kB 105.55 kB
facebook-www/ReactDOM-prod.modern.js = 571.54 kB 571.54 kB = 101.75 kB 101.75 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-esm/esm/react-server-dom-esm-client.browser.production.js +0.89% 78.12 kB 78.82 kB +0.77% 16.58 kB 16.71 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.production.js +0.68% 47.27 kB 47.59 kB +0.55% 9.64 kB 9.69 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.production.js +0.65% 48.87 kB 49.19 kB +0.53% 10.01 kB 10.06 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.js +0.65% 49.21 kB 49.53 kB +0.53% 10.10 kB 10.15 kB
oss-experimental/react-client/cjs/react-client-flight.production.js +0.62% 53.13 kB 53.46 kB +0.55% 9.81 kB 9.86 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-client.node.production.js +0.62% 51.52 kB 51.84 kB +0.48% 10.64 kB 10.69 kB
oss-stable-rc/react-server/cjs/react-server-flight.production.js +0.62% 58.01 kB 58.37 kB +0.24% 11.60 kB 11.63 kB
oss-stable-semver/react-server/cjs/react-server-flight.production.js +0.62% 58.01 kB 58.37 kB +0.24% 11.60 kB 11.63 kB
oss-stable/react-server/cjs/react-server-flight.production.js +0.62% 58.01 kB 58.37 kB +0.24% 11.60 kB 11.63 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.unbundled.production.js +0.60% 52.78 kB 53.10 kB +0.47% 10.92 kB 10.97 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.production.js +0.59% 53.48 kB 53.80 kB +0.44% 11.08 kB 11.13 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.js +0.59% 54.62 kB 54.94 kB +0.46% 11.30 kB 11.36 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.production.js +0.59% 54.63 kB 54.95 kB +0.46% 11.29 kB 11.35 kB
oss-experimental/react-server-dom-esm/esm/react-server-dom-esm-client.browser.development.js +0.56% 124.06 kB 124.75 kB +0.50% 29.01 kB 29.15 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.js +0.56% 56.35 kB 56.67 kB +0.48% 11.43 kB 11.49 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.js +0.55% 57.04 kB 57.35 kB +0.47% 11.59 kB 11.65 kB
oss-stable-rc/react-server/cjs/react-server-flight.development.js +0.54% 88.52 kB 88.99 kB +0.33% 16.36 kB 16.41 kB
oss-stable-semver/react-server/cjs/react-server-flight.development.js +0.54% 88.52 kB 88.99 kB +0.33% 16.36 kB 16.41 kB
oss-stable/react-server/cjs/react-server-flight.development.js +0.54% 88.52 kB 88.99 kB +0.33% 16.36 kB 16.41 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.development.js +0.41% 87.52 kB 87.87 kB +0.34% 16.53 kB 16.59 kB
oss-experimental/react-client/cjs/react-client-flight.development.js +0.40% 89.12 kB 89.48 kB +0.29% 16.37 kB 16.42 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js +0.40% 89.37 kB 89.73 kB +0.34% 16.93 kB 16.99 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +0.40% 89.83 kB 90.18 kB +0.33% 17.04 kB 17.10 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-client.node.development.js +0.38% 92.47 kB 92.82 kB +0.31% 17.82 kB 17.88 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.unbundled.development.js +0.38% 93.88 kB 94.24 kB +0.30% 18.12 kB 18.17 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.development.js +0.37% 94.69 kB 95.05 kB +0.37% 18.29 kB 18.35 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js +0.37% 96.06 kB 96.41 kB +0.35% 18.53 kB 18.60 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.development.js +0.37% 96.07 kB 96.43 kB +0.35% 18.51 kB 18.58 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js +0.37% 97.86 kB 98.22 kB +0.31% 18.63 kB 18.69 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js +0.36% 98.66 kB 99.02 kB +0.38% 18.81 kB 18.88 kB
oss-experimental/react-server/cjs/react-server-flight.production.js +0.34% 63.15 kB 63.36 kB +0.22% 12.45 kB 12.48 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.production.js +0.25% 97.91 kB 98.15 kB +0.23% 19.75 kB 19.80 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.js +0.25% 98.23 kB 98.47 kB +0.22% 19.85 kB 19.89 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js +0.25% 98.33 kB 98.57 kB +0.21% 19.88 kB 19.92 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.js +0.25% 98.36 kB 98.60 kB +0.22% 19.87 kB 19.92 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-server.node.production.js +0.23% 94.74 kB 94.96 kB +0.26% 19.40 kB 19.45 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js +0.22% 100.39 kB 100.61 kB +0.22% 20.28 kB 20.33 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.production.js +0.22% 100.41 kB 100.63 kB +0.22% 20.29 kB 20.33 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js +0.22% 101.35 kB 101.57 kB +0.17% 20.56 kB 20.60 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.production.js +0.22% 101.38 kB 101.60 kB +0.18% 20.55 kB 20.59 kB

Generated by 🚫 dangerJS against 6a12b85

packages/react-client/src/ReactFlightClient.js Outdated Show resolved Hide resolved
packages/react-client/src/ReactFlightClient.js Outdated Show resolved Hide resolved
packages/react-server/src/ReactFlightServer.js Outdated Show resolved Hide resolved
packages/react-server/src/ReactFlightServer.js Outdated Show resolved Hide resolved
function allReady(request: Request) {
const onAllReady = request.onAllReady;
onAllReady();
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we unify the rest of halt/abort, then this helper doesn't become necessary.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do in the next where we re-add the error and postpone logging

chunks.set(id, createBlockedChunk(response));
} else {
const blockedChunk: BlockedChunk<mixed> = (chunk: any);
blockedChunk.status = BLOCKED;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think technically maybe you need to check if it is pending first. Because it could've maybe been rejected already if we aborted between the reference and this row.

using infinitely suspending promises isn't right because this will parse as a promise which is only appropriate if the value we're halting at is a promise. Instead we need to have a special marker type that says this reference will never resolve. Additionally flight client needs to not error any halted references when the stream closes because they will otherwise appear as an error
@gnoff gnoff merged commit 9d082b5 into facebook:main Aug 19, 2024
185 checks passed
@gnoff gnoff deleted the refactor-flight-prerender branch August 19, 2024 18:24
sebmarkbage added a commit that referenced this pull request Aug 19, 2024
Stacked on #30731.

When logging a Promise we emit it as an infinite promise instead of
blocking the replay on it.

This models that as a halted row instead. No need for this special case.

I unflag the receiving side since now it's used to replace a feature
that's already unflagged so it's used.
gnoff added a commit that referenced this pull request Aug 20, 2024
stacked on: #30731

We've refined the model of halting a prerender. Now when you abort
during a prerender we simply omit the rows that would complete the
flight render. This is analagous to prerendering in Fizz where you must
resume the prerender to actually result in errors propagating in the
postponed holes. We don't have a resume yet for flight and it's not
entirely clear how that will work however the key insight here is that
deciding whether the never resolving rows are an error or not should
really be done on the consuming side rather than in the producer.

This PR also reintroduces the logs for the abort error/postpone when
prerendering which will give you some indication that something wasn't
finished when the prerender was aborted.
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.

5 participants