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

[Fiber] Support Suspense boundaries anywhere (excluding hydration) #32163

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gnoff
Copy link
Collaborator

@gnoff gnoff commented Jan 22, 2025

This is a follow up to #32069

In the prior change I updated Fizz to allow you to render Suspense boundaries at any level within a react-dom application by treating the document body as the default render scope. This change updates Fiber to provide similar semantics. Note that this update still does not deliver hydration so unifying the Fizz and Fiber implementations in a single App is not possible yet.

The implementation required a rework of the getHostSibling and getHostParent algorithms. Now most HostSingletons are invisible from a host positioning perspective. Head is special in that it is a valid host scope so when you have Placements inside of it, it will act as the parent. But body, and html, will not directly participate in host positioning.

Additionally to support flipping to a fallback , , and tag in a Suspense fallback I updated the offscreen hiding/unhide logic to pierce through singletons when lookin for matching hidable nod boundaries anywhere (excluding hydration)

@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Jan 22, 2025
@gnoff gnoff force-pushed the suspense-anywhere-fiber-render branch 2 times, most recently from ea3ae19 to 3089cbf Compare January 22, 2025 22:42
@@ -130,6 +131,8 @@ export const PassiveTransitionMask: number = PassiveMask | Update | Placement;
// This allows certain concepts to persist without recalculating them,
// e.g. whether a subtree contains passive effects or portals.
export const StaticMask =
SnapshotStatic |
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 think this was missed so I added it

This is a follow up to facebook#32069

In the prior change I updated Fizz to allow you to render Suspense boundaries at any level within a react-dom application by treating the document body as the default render scope. This change updates Fiber to provide similar semantics. Note that this update still does not deliver hydration so unifying the Fizz and Fiber implementations in a single App is not possible yet.

The implementation required a rework of the getHostSibling and getHostParent algorithms. Now most HostSingletons are invisible from a host positioning perspective. Head is special in that it is a valid host scope so when you have Placements inside of it, it will act as the parent. But body, and html, will not directly participate in host positioning.

Additionally to support flipping to a fallback <html>, <head>, and <body> tag in a Suspense fallback I updated the offscreen hiding/unhide logic to pierce through singletons when lookin for matching hidable nod boundaries anywhere (excluding hydration)
@react-sizebot
Copy link

Comparing: ae9017c...3ea8497

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 +0.05% 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js +0.24% 514.24 kB 515.47 kB +0.11% 91.73 kB 91.83 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB +0.05% 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js +0.14% 557.28 kB 558.06 kB = 98.97 kB 98.91 kB
facebook-www/ReactDOM-prod.classic.js +0.28% 595.79 kB 597.44 kB +0.12% 104.85 kB 104.98 kB
facebook-www/ReactDOM-prod.modern.js +0.28% 586.21 kB 587.87 kB +0.13% 103.30 kB 103.44 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
facebook-react-native/react-dom/cjs/ReactDOMClient-profiling.js +0.34% 564.32 kB 566.24 kB +0.14% 99.51 kB 99.65 kB
facebook-react-native/react-dom/cjs/ReactDOMProfiling-profiling.js +0.34% 570.27 kB 572.18 kB +0.14% 100.67 kB 100.81 kB
facebook-www/ReactDOM-profiling.modern.js +0.34% 613.21 kB 615.27 kB +0.16% 107.13 kB 107.30 kB
facebook-www/ReactDOM-profiling.classic.js +0.33% 622.83 kB 624.89 kB +0.16% 108.71 kB 108.89 kB
facebook-www/ReactReconciler-prod.modern.js +0.32% 451.22 kB 452.67 kB +0.15% 72.55 kB 72.66 kB
facebook-www/ReactReconciler-prod.classic.js +0.31% 461.37 kB 462.82 kB +0.15% 74.11 kB 74.21 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler.production.js +0.30% 389.90 kB 391.07 kB +0.21% 63.27 kB 63.40 kB
oss-stable/react-reconciler/cjs/react-reconciler.production.js +0.30% 389.92 kB 391.09 kB +0.21% 63.30 kB 63.43 kB
oss-stable-semver/react-dom/cjs/react-dom-profiling.profiling.js +0.29% 544.48 kB 546.05 kB +0.12% 96.45 kB 96.56 kB
oss-stable/react-dom/cjs/react-dom-profiling.profiling.js +0.29% 544.61 kB 546.17 kB +0.12% 96.47 kB 96.59 kB
facebook-www/ReactDOM-prod.modern.js +0.28% 586.21 kB 587.87 kB +0.13% 103.30 kB 103.44 kB
facebook-react-native/react-dom/cjs/ReactDOMClient-prod.js +0.28% 539.50 kB 541.02 kB +0.16% 95.74 kB 95.89 kB
facebook-react-native/react-dom/cjs/ReactDOMProfiling-prod.js +0.28% 545.01 kB 546.53 kB +0.16% 96.82 kB 96.97 kB
facebook-www/ReactDOM-prod.classic.js +0.28% 595.79 kB 597.44 kB +0.12% 104.85 kB 104.98 kB
facebook-www/ReactDOMTesting-prod.modern.js +0.28% 600.93 kB 602.59 kB +0.12% 106.99 kB 107.13 kB
facebook-www/ReactDOMTesting-prod.classic.js +0.27% 610.50 kB 612.16 kB +0.12% 108.54 kB 108.67 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler.profiling.js +0.26% 416.14 kB 417.24 kB +0.17% 66.93 kB 67.05 kB
oss-stable/react-reconciler/cjs/react-reconciler.profiling.js +0.26% 416.17 kB 417.26 kB +0.17% 66.95 kB 67.07 kB
oss-stable-semver/react-dom/cjs/react-dom-client.development.js +0.24% 942.24 kB 944.54 kB +0.13% 159.12 kB 159.33 kB
oss-stable/react-dom/cjs/react-dom-client.development.js +0.24% 942.37 kB 944.66 kB +0.13% 159.15 kB 159.35 kB
oss-stable-semver/react-dom/cjs/react-dom-profiling.development.js +0.24% 958.68 kB 960.98 kB +0.13% 161.95 kB 162.16 kB
oss-stable/react-dom/cjs/react-dom-profiling.development.js +0.24% 958.81 kB 961.10 kB +0.13% 161.98 kB 162.19 kB
oss-stable-semver/react-dom/cjs/react-dom-client.production.js +0.24% 514.11 kB 515.34 kB +0.11% 91.71 kB 91.81 kB
oss-stable/react-dom/cjs/react-dom-client.production.js +0.24% 514.24 kB 515.47 kB +0.11% 91.73 kB 91.83 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler.development.js +0.23% 640.21 kB 641.65 kB +0.11% 102.07 kB 102.19 kB
oss-stable/react-reconciler/cjs/react-reconciler.development.js +0.23% 640.24 kB 641.68 kB +0.11% 102.09 kB 102.21 kB
facebook-www/ReactDOM-dev.modern.js +0.22% 1,061.48 kB 1,063.82 kB +0.12% 176.88 kB 177.08 kB
facebook-react-native/react-dom/cjs/ReactDOMClient-dev.js +0.22% 992.23 kB 994.41 kB +0.10% 166.83 kB 166.99 kB
facebook-www/ReactDOM-dev.classic.js +0.22% 1,070.62 kB 1,072.97 kB +0.11% 178.58 kB 178.79 kB
facebook-www/ReactDOMTesting-dev.modern.js +0.22% 1,078.38 kB 1,080.73 kB +0.10% 180.80 kB 180.98 kB
facebook-react-native/react-dom/cjs/ReactDOMProfiling-dev.js +0.22% 1,008.57 kB 1,010.75 kB +0.10% 169.65 kB 169.81 kB
facebook-www/ReactDOMTesting-dev.classic.js +0.22% 1,087.53 kB 1,089.87 kB +0.09% 182.53 kB 182.69 kB
oss-experimental/react-art/cjs/react-art.production.js = 322.55 kB 321.65 kB = 54.86 kB 54.68 kB
oss-experimental/react/cjs/react.development.js = 46.15 kB 45.83 kB = 10.53 kB 10.47 kB
oss-experimental/react/cjs/react.production.js = 18.42 kB 18.13 kB = 4.77 kB 4.71 kB
oss-experimental/react-debug-tools/cjs/react-debug-tools.development.js = 32.24 kB 31.60 kB = 5.77 kB 5.69 kB
oss-stable-semver/react-debug-tools/cjs/react-debug-tools.development.js = 32.24 kB 31.60 kB = 5.77 kB 5.69 kB
oss-stable/react-debug-tools/cjs/react-debug-tools.development.js = 32.24 kB 31.60 kB = 5.77 kB 5.69 kB
oss-experimental/react-debug-tools/cjs/react-debug-tools.production.js = 28.72 kB 28.15 kB = 5.64 kB 5.56 kB
oss-stable-semver/react-debug-tools/cjs/react-debug-tools.production.js = 28.72 kB 28.15 kB = 5.64 kB 5.56 kB
oss-stable/react-debug-tools/cjs/react-debug-tools.production.js = 28.72 kB 28.15 kB = 5.64 kB 5.56 kB

Generated by 🚫 dangerJS against a9727fb

@gnoff gnoff requested a review from sebmarkbage January 22, 2025 23:03
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.

3 participants