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] Replay Postponed Paths #27379

Merged
merged 7 commits into from
Sep 15, 2023
Merged

Conversation

sebmarkbage
Copy link
Collaborator

This forks Task into ReplayTask and RenderTask.

A RenderTask is the normal mode and it has a segment to write into.

A ReplayTask doesn't have a segment to write into because that has already been written but instead it has a ReplayState which keeps track of the next set of paths to follow. Once we hit a "Resume" node we convert it into a RenderTask and continue rendering from there.

We can resume at either an Element position or a Slot position. An Element pointing to a component doesn't mean we resume that component, it means we resume in the child position directly below that component. Slots are slots inside arrays.

Instead of statically forking most paths, I kept using the same path and checked for the existence of a segment or replay state dynamically at runtime.

However, there's still quite a bit of forking here like retryRenderTask and retryReplayTask. Even in the new forks there's a lot of duplication like resumeSuspenseBoundary, replaySuspenseBoundary and renderSuspenseBoundary. There's opportunity to simplify this a bit.

A ReplayTask is a task that isn't writing to the output but follows a
resumable path. Most of the code paths will be reused for this type of
work.
If we have ResumeSlots we don't have an element key to match them with.
This only happens inside an array.

If we have any, we can simply pick those children out of the array and
resume them by rendering that node normally into the relevant segment.
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Sep 14, 2023
It's like a combination of ReplaySuspenseBoundary and ResumeElement.
@react-sizebot
Copy link

Comparing: a6e4791...5b276c6

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 = 166.62 kB 166.62 kB = 52.13 kB 52.13 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 176.05 kB 176.05 kB = 54.96 kB 54.97 kB
facebook-www/ReactDOM-prod.classic.js = 571.73 kB 571.73 kB = 100.64 kB 100.64 kB
facebook-www/ReactDOM-prod.modern.js = 555.46 kB 555.46 kB = 97.75 kB 97.75 kB
oss-stable-semver/react-server/cjs/react-server.production.min.js +19.85% 27.48 kB 32.93 kB +12.34% 9.19 kB 10.32 kB
oss-stable/react-server/cjs/react-server.production.min.js +19.85% 27.48 kB 32.93 kB +12.34% 9.19 kB 10.32 kB
oss-experimental/react-server/cjs/react-server.production.min.js +19.47% 30.00 kB 35.84 kB +12.46% 9.93 kB 11.17 kB
oss-stable-semver/react-server/cjs/react-server.development.js +14.03% 156.16 kB 178.07 kB +7.06% 38.35 kB 41.06 kB
oss-stable/react-server/cjs/react-server.development.js +14.03% 156.16 kB 178.07 kB +7.06% 38.35 kB 41.06 kB
oss-experimental/react-server/cjs/react-server.development.js +13.86% 169.92 kB 193.46 kB +6.90% 41.74 kB 44.63 kB
facebook-www/ReactDOMServerStreaming-prod.modern.js +11.23% 159.85 kB 177.80 kB +7.33% 29.76 kB 31.94 kB
facebook-www/ReactDOMServer-prod.classic.js +10.19% 158.43 kB 174.56 kB +6.53% 29.00 kB 30.89 kB
facebook-www/ReactDOMServer-prod.modern.js +10.06% 157.75 kB 173.63 kB +6.45% 28.80 kB 30.66 kB
oss-experimental/react-dom/cjs/react-dom-server.bun.production.min.js +8.53% 69.97 kB 75.94 kB +6.08% 21.61 kB 22.92 kB
oss-stable-semver/react-dom/cjs/react-dom-server.bun.production.min.js +8.49% 65.89 kB 71.49 kB +5.85% 20.27 kB 21.46 kB
oss-stable/react-dom/cjs/react-dom-server.bun.production.min.js +8.49% 65.92 kB 71.51 kB +5.84% 20.30 kB 21.48 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.production.min.js +8.35% 71.52 kB 77.49 kB +6.15% 21.89 kB 23.23 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.production.min.js +8.30% 67.44 kB 73.04 kB +5.81% 20.54 kB 21.73 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.production.min.js +8.29% 67.47 kB 73.06 kB +5.81% 20.56 kB 21.75 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.production.min.js +8.21% 67.79 kB 73.36 kB +5.35% 21.30 kB 22.44 kB
oss-stable/react-dom/cjs/react-dom-server.edge.production.min.js +8.21% 67.82 kB 73.39 kB +5.34% 21.32 kB 22.46 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.production.min.js +8.20% 67.85 kB 73.42 kB +5.51% 21.32 kB 22.49 kB
oss-stable/react-dom/cjs/react-dom-server.node.production.min.js +8.20% 67.88 kB 73.44 kB +5.51% 21.34 kB 22.52 kB
oss-experimental/react-dom/cjs/react-dom-server.edge.production.min.js +8.03% 73.76 kB 79.68 kB +5.61% 22.83 kB 24.11 kB
oss-experimental/react-dom/cjs/react-dom-server.node.production.min.js +8.00% 74.03 kB 79.96 kB +5.49% 23.01 kB 24.27 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +7.35% 66.39 kB 71.27 kB +5.67% 20.22 kB 21.36 kB
oss-experimental/react-dom/umd/react-dom-server-legacy.browser.production.min.js +7.33% 66.54 kB 71.42 kB +5.46% 20.61 kB 21.74 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +7.20% 62.56 kB 67.06 kB +5.35% 18.92 kB 19.93 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +7.20% 62.59 kB 67.09 kB +5.35% 18.94 kB 19.96 kB
oss-stable-semver/react-dom/umd/react-dom-server-legacy.browser.production.min.js +7.18% 62.72 kB 67.22 kB +5.59% 19.21 kB 20.29 kB
oss-stable/react-dom/umd/react-dom-server-legacy.browser.production.min.js +7.18% 62.74 kB 67.25 kB +5.58% 19.24 kB 20.31 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.production.min.js +7.09% 63.57 kB 68.08 kB +5.12% 19.86 kB 20.88 kB
oss-stable/react-dom/cjs/react-dom-server.browser.production.min.js +7.09% 63.59 kB 68.10 kB +5.11% 19.89 kB 20.90 kB
oss-stable-semver/react-dom/umd/react-dom-server.browser.production.min.js +7.08% 63.71 kB 68.22 kB +5.41% 20.09 kB 21.18 kB
oss-stable/react-dom/umd/react-dom-server.browser.production.min.js +7.07% 63.74 kB 68.24 kB +5.40% 20.12 kB 21.21 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.production.min.js +7.02% 69.31 kB 74.17 kB +5.28% 21.34 kB 22.47 kB
oss-experimental/react-dom/umd/react-dom-server.browser.production.min.js +7.01% 69.43 kB 74.30 kB +5.42% 21.60 kB 22.77 kB
facebook-www/ReactDOMServerStreaming-dev.modern.js +6.68% 351.40 kB 374.87 kB +3.65% 78.35 kB 81.21 kB
oss-experimental/react-dom/cjs/react-dom-server.bun.development.js +6.59% 361.12 kB 384.93 kB +3.52% 81.53 kB 84.40 kB
facebook-www/ReactDOMServer-dev.modern.js +6.59% 356.20 kB 379.67 kB +3.59% 79.49 kB 82.35 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.development.js +6.55% 363.62 kB 387.44 kB +3.50% 81.97 kB 84.83 kB
oss-experimental/react-dom/umd/react-dom-server-legacy.browser.development.js +6.53% 381.06 kB 405.93 kB +3.53% 82.82 kB 85.74 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.development.js +6.51% 365.53 kB 389.35 kB +3.48% 82.42 kB 85.29 kB
oss-stable-semver/react-dom/cjs/react-dom-server.bun.development.js +6.49% 341.63 kB 363.81 kB +3.47% 77.26 kB 79.94 kB
oss-stable/react-dom/cjs/react-dom-server.bun.development.js +6.49% 341.65 kB 363.84 kB +3.47% 77.28 kB 79.96 kB
facebook-www/ReactDOMServer-dev.classic.js +6.45% 363.63 kB 387.10 kB +3.53% 81.13 kB 84.00 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.development.js +6.45% 344.13 kB 366.31 kB +3.45% 77.68 kB 80.36 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.development.js +6.45% 344.16 kB 366.34 kB +3.45% 77.71 kB 80.39 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.development.js +6.44% 344.40 kB 366.59 kB +3.43% 78.16 kB 80.84 kB
oss-stable/react-dom/cjs/react-dom-server.browser.development.js +6.44% 344.43 kB 366.61 kB +3.43% 78.19 kB 80.87 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.development.js +6.43% 344.81 kB 367.00 kB +3.43% 78.28 kB 80.96 kB
oss-stable/react-dom/cjs/react-dom-server.edge.development.js +6.43% 344.84 kB 367.02 kB +3.43% 78.30 kB 80.99 kB
oss-stable-semver/react-dom/umd/react-dom-server-legacy.browser.development.js +6.43% 360.79 kB 383.97 kB +3.43% 78.52 kB 81.22 kB
oss-stable/react-dom/umd/react-dom-server-legacy.browser.development.js +6.43% 360.81 kB 384.00 kB +3.43% 78.55 kB 81.25 kB
oss-stable-semver/react-dom/umd/react-dom-server.browser.development.js +6.42% 361.06 kB 384.25 kB +3.42% 79.01 kB 81.71 kB
oss-stable/react-dom/umd/react-dom-server.browser.development.js +6.42% 361.09 kB 384.27 kB +3.42% 79.04 kB 81.74 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.development.js +6.41% 345.88 kB 368.06 kB +3.43% 78.19 kB 80.87 kB
oss-stable/react-dom/cjs/react-dom-server.node.development.js +6.41% 345.91 kB 368.09 kB +3.43% 78.22 kB 80.90 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.development.js +6.41% 346.04 kB 368.22 kB +3.43% 78.14 kB 80.82 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.development.js +6.41% 346.07 kB 368.25 kB +3.43% 78.16 kB 80.85 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.development.js +6.37% 369.75 kB 393.29 kB +3.49% 82.69 kB 85.58 kB
oss-experimental/react-dom/cjs/react-dom-server.edge.development.js +6.36% 370.16 kB 393.70 kB +3.48% 82.82 kB 85.70 kB
oss-experimental/react-dom/umd/react-dom-server.browser.development.js +6.35% 387.48 kB 412.08 kB +3.49% 83.58 kB 86.49 kB
oss-experimental/react-dom/cjs/react-dom-server.node.development.js +6.35% 371.05 kB 394.59 kB +3.47% 83.01 kB 85.90 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable-semver/react-server/cjs/react-server.production.min.js +19.85% 27.48 kB 32.93 kB +12.34% 9.19 kB 10.32 kB
oss-stable/react-server/cjs/react-server.production.min.js +19.85% 27.48 kB 32.93 kB +12.34% 9.19 kB 10.32 kB
oss-experimental/react-server/cjs/react-server.production.min.js +19.47% 30.00 kB 35.84 kB +12.46% 9.93 kB 11.17 kB
oss-stable-semver/react-server/cjs/react-server.development.js +14.03% 156.16 kB 178.07 kB +7.06% 38.35 kB 41.06 kB
oss-stable/react-server/cjs/react-server.development.js +14.03% 156.16 kB 178.07 kB +7.06% 38.35 kB 41.06 kB
oss-experimental/react-server/cjs/react-server.development.js +13.86% 169.92 kB 193.46 kB +6.90% 41.74 kB 44.63 kB
facebook-www/ReactDOMServerStreaming-prod.modern.js +11.23% 159.85 kB 177.80 kB +7.33% 29.76 kB 31.94 kB
facebook-www/ReactDOMServer-prod.classic.js +10.19% 158.43 kB 174.56 kB +6.53% 29.00 kB 30.89 kB
facebook-www/ReactDOMServer-prod.modern.js +10.06% 157.75 kB 173.63 kB +6.45% 28.80 kB 30.66 kB
oss-experimental/react-dom/cjs/react-dom-server.bun.production.min.js +8.53% 69.97 kB 75.94 kB +6.08% 21.61 kB 22.92 kB
oss-stable-semver/react-dom/cjs/react-dom-server.bun.production.min.js +8.49% 65.89 kB 71.49 kB +5.85% 20.27 kB 21.46 kB
oss-stable/react-dom/cjs/react-dom-server.bun.production.min.js +8.49% 65.92 kB 71.51 kB +5.84% 20.30 kB 21.48 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.production.min.js +8.35% 71.52 kB 77.49 kB +6.15% 21.89 kB 23.23 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.production.min.js +8.30% 67.44 kB 73.04 kB +5.81% 20.54 kB 21.73 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.production.min.js +8.29% 67.47 kB 73.06 kB +5.81% 20.56 kB 21.75 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.production.min.js +8.21% 67.79 kB 73.36 kB +5.35% 21.30 kB 22.44 kB
oss-stable/react-dom/cjs/react-dom-server.edge.production.min.js +8.21% 67.82 kB 73.39 kB +5.34% 21.32 kB 22.46 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.production.min.js +8.20% 67.85 kB 73.42 kB +5.51% 21.32 kB 22.49 kB
oss-stable/react-dom/cjs/react-dom-server.node.production.min.js +8.20% 67.88 kB 73.44 kB +5.51% 21.34 kB 22.52 kB
oss-experimental/react-dom/cjs/react-dom-server.edge.production.min.js +8.03% 73.76 kB 79.68 kB +5.61% 22.83 kB 24.11 kB
oss-experimental/react-dom/cjs/react-dom-server.node.production.min.js +8.00% 74.03 kB 79.96 kB +5.49% 23.01 kB 24.27 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +7.35% 66.39 kB 71.27 kB +5.67% 20.22 kB 21.36 kB
oss-experimental/react-dom/umd/react-dom-server-legacy.browser.production.min.js +7.33% 66.54 kB 71.42 kB +5.46% 20.61 kB 21.74 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +7.20% 62.56 kB 67.06 kB +5.35% 18.92 kB 19.93 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +7.20% 62.59 kB 67.09 kB +5.35% 18.94 kB 19.96 kB
oss-stable-semver/react-dom/umd/react-dom-server-legacy.browser.production.min.js +7.18% 62.72 kB 67.22 kB +5.59% 19.21 kB 20.29 kB
oss-stable/react-dom/umd/react-dom-server-legacy.browser.production.min.js +7.18% 62.74 kB 67.25 kB +5.58% 19.24 kB 20.31 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.production.min.js +7.09% 63.57 kB 68.08 kB +5.12% 19.86 kB 20.88 kB
oss-stable/react-dom/cjs/react-dom-server.browser.production.min.js +7.09% 63.59 kB 68.10 kB +5.11% 19.89 kB 20.90 kB
oss-stable-semver/react-dom/umd/react-dom-server.browser.production.min.js +7.08% 63.71 kB 68.22 kB +5.41% 20.09 kB 21.18 kB
oss-stable/react-dom/umd/react-dom-server.browser.production.min.js +7.07% 63.74 kB 68.24 kB +5.40% 20.12 kB 21.21 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.production.min.js +7.02% 69.31 kB 74.17 kB +5.28% 21.34 kB 22.47 kB
oss-experimental/react-dom/umd/react-dom-server.browser.production.min.js +7.01% 69.43 kB 74.30 kB +5.42% 21.60 kB 22.77 kB
facebook-www/ReactDOMServerStreaming-dev.modern.js +6.68% 351.40 kB 374.87 kB +3.65% 78.35 kB 81.21 kB
oss-experimental/react-dom/cjs/react-dom-server.bun.development.js +6.59% 361.12 kB 384.93 kB +3.52% 81.53 kB 84.40 kB
facebook-www/ReactDOMServer-dev.modern.js +6.59% 356.20 kB 379.67 kB +3.59% 79.49 kB 82.35 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.development.js +6.55% 363.62 kB 387.44 kB +3.50% 81.97 kB 84.83 kB
oss-experimental/react-dom/umd/react-dom-server-legacy.browser.development.js +6.53% 381.06 kB 405.93 kB +3.53% 82.82 kB 85.74 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.development.js +6.51% 365.53 kB 389.35 kB +3.48% 82.42 kB 85.29 kB
oss-stable-semver/react-dom/cjs/react-dom-server.bun.development.js +6.49% 341.63 kB 363.81 kB +3.47% 77.26 kB 79.94 kB
oss-stable/react-dom/cjs/react-dom-server.bun.development.js +6.49% 341.65 kB 363.84 kB +3.47% 77.28 kB 79.96 kB
facebook-www/ReactDOMServer-dev.classic.js +6.45% 363.63 kB 387.10 kB +3.53% 81.13 kB 84.00 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.development.js +6.45% 344.13 kB 366.31 kB +3.45% 77.68 kB 80.36 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.development.js +6.45% 344.16 kB 366.34 kB +3.45% 77.71 kB 80.39 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.development.js +6.44% 344.40 kB 366.59 kB +3.43% 78.16 kB 80.84 kB
oss-stable/react-dom/cjs/react-dom-server.browser.development.js +6.44% 344.43 kB 366.61 kB +3.43% 78.19 kB 80.87 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.development.js +6.43% 344.81 kB 367.00 kB +3.43% 78.28 kB 80.96 kB
oss-stable/react-dom/cjs/react-dom-server.edge.development.js +6.43% 344.84 kB 367.02 kB +3.43% 78.30 kB 80.99 kB
oss-stable-semver/react-dom/umd/react-dom-server-legacy.browser.development.js +6.43% 360.79 kB 383.97 kB +3.43% 78.52 kB 81.22 kB
oss-stable/react-dom/umd/react-dom-server-legacy.browser.development.js +6.43% 360.81 kB 384.00 kB +3.43% 78.55 kB 81.25 kB
oss-stable-semver/react-dom/umd/react-dom-server.browser.development.js +6.42% 361.06 kB 384.25 kB +3.42% 79.01 kB 81.71 kB
oss-stable/react-dom/umd/react-dom-server.browser.development.js +6.42% 361.09 kB 384.27 kB +3.42% 79.04 kB 81.74 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.development.js +6.41% 345.88 kB 368.06 kB +3.43% 78.19 kB 80.87 kB
oss-stable/react-dom/cjs/react-dom-server.node.development.js +6.41% 345.91 kB 368.09 kB +3.43% 78.22 kB 80.90 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.development.js +6.41% 346.04 kB 368.22 kB +3.43% 78.14 kB 80.82 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.development.js +6.41% 346.07 kB 368.25 kB +3.43% 78.16 kB 80.85 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.development.js +6.37% 369.75 kB 393.29 kB +3.49% 82.69 kB 85.58 kB
oss-experimental/react-dom/cjs/react-dom-server.edge.development.js +6.36% 370.16 kB 393.70 kB +3.48% 82.82 kB 85.70 kB
oss-experimental/react-dom/umd/react-dom-server.browser.development.js +6.35% 387.48 kB 412.08 kB +3.49% 83.58 kB 86.49 kB
oss-experimental/react-dom/cjs/react-dom-server.node.development.js +6.35% 371.05 kB 394.59 kB +3.47% 83.01 kB 85.90 kB

Generated by 🚫 dangerJS against 5b276c6

@sebmarkbage sebmarkbage merged commit a5fc797 into facebook:main Sep 15, 2023
2 checks passed
github-actions bot pushed a commit that referenced this pull request Sep 15, 2023
This forks Task into ReplayTask and RenderTask.

A RenderTask is the normal mode and it has a segment to write into.

A ReplayTask doesn't have a segment to write into because that has
already been written but instead it has a ReplayState which keeps track
of the next set of paths to follow. Once we hit a "Resume" node we
convert it into a RenderTask and continue rendering from there.

We can resume at either an Element position or a Slot position. An
Element pointing to a component doesn't mean we resume that component,
it means we resume in the child position directly below that component.
Slots are slots inside arrays.

Instead of statically forking most paths, I kept using the same path and
checked for the existence of a segment or replay state dynamically at
runtime.

However, there's still quite a bit of forking here like retryRenderTask
and retryReplayTask. Even in the new forks there's a lot of duplication
like resumeSuspenseBoundary, replaySuspenseBoundary and
renderSuspenseBoundary. There's opportunity to simplify this a bit.

DiffTrain build for [a5fc797](a5fc797)
Comment on lines +1005 to +1011
if (enableFloat) {
// Does this even matter for replaying?
setCurrentlyRenderingBoundaryResourcesTarget(
request.renderState,
resumedBoundary.resources,
);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

A child of this boundary may need to render and during that render new styles could be discovered so we'd want to associate those to this boundary. Makes sense to me that this is still needed

kodiakhq bot pushed a commit to vercel/next.js that referenced this pull request Sep 20, 2023
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
This forks Task into ReplayTask and RenderTask.

A RenderTask is the normal mode and it has a segment to write into.

A ReplayTask doesn't have a segment to write into because that has
already been written but instead it has a ReplayState which keeps track
of the next set of paths to follow. Once we hit a "Resume" node we
convert it into a RenderTask and continue rendering from there.

We can resume at either an Element position or a Slot position. An
Element pointing to a component doesn't mean we resume that component,
it means we resume in the child position directly below that component.
Slots are slots inside arrays.

Instead of statically forking most paths, I kept using the same path and
checked for the existence of a segment or replay state dynamically at
runtime.

However, there's still quite a bit of forking here like retryRenderTask
and retryReplayTask. Even in the new forks there's a lot of duplication
like resumeSuspenseBoundary, replaySuspenseBoundary and
renderSuspenseBoundary. There's opportunity to simplify this a bit.
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
This forks Task into ReplayTask and RenderTask.

A RenderTask is the normal mode and it has a segment to write into.

A ReplayTask doesn't have a segment to write into because that has
already been written but instead it has a ReplayState which keeps track
of the next set of paths to follow. Once we hit a "Resume" node we
convert it into a RenderTask and continue rendering from there.

We can resume at either an Element position or a Slot position. An
Element pointing to a component doesn't mean we resume that component,
it means we resume in the child position directly below that component.
Slots are slots inside arrays.

Instead of statically forking most paths, I kept using the same path and
checked for the existence of a segment or replay state dynamically at
runtime.

However, there's still quite a bit of forking here like retryRenderTask
and retryReplayTask. Even in the new forks there's a lot of duplication
like resumeSuspenseBoundary, replaySuspenseBoundary and
renderSuspenseBoundary. There's opportunity to simplify this a bit.

DiffTrain build for commit a5fc797.
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