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

Implement Offscreen in Fizz #24988

Merged
merged 1 commit into from
Jul 26, 2022
Merged

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Jul 25, 2022

During server rendering, a visible Offscreen subtree acts exactly like a fragment: a pure indirection.

A hidden Offscreen subtree is not server rendered at all. It's ignored during hydration, too. Prerendering happens only on the client. We considered prerendering hidden trees on the server, too, but our conclusion is that it's a waste of bytes and server computation. We can't think of any compelling cases where it's the right trade off. (If we ever change our mind, though, the way we'll likely model it is to treat it as if it's a Suspense boundary with an empty fallback.)

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Jul 25, 2022
@acdlite acdlite requested review from sammy-SC and gnoff July 25, 2022 16:08
@sizebot
Copy link

sizebot commented Jul 25, 2022

Comparing: 6b28bc9...b45cd19

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 = 132.92 kB 132.92 kB = 42.68 kB 42.68 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 138.15 kB 138.15 kB = 44.19 kB 44.19 kB
facebook-www/ReactDOM-prod.classic.js = 469.02 kB 469.02 kB = 84.22 kB 84.22 kB
facebook-www/ReactDOM-prod.modern.js = 454.26 kB 454.26 kB = 81.98 kB 81.98 kB
facebook-www/ReactDOMForked-prod.classic.js = 469.02 kB 469.02 kB = 84.22 kB 84.22 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.development.js +0.45% 130.50 kB 131.09 kB +0.54% 32.67 kB 32.85 kB
oss-stable/react-server/cjs/react-server.development.js +0.45% 130.50 kB 131.09 kB +0.54% 32.67 kB 32.85 kB
oss-experimental/react-server/cjs/react-server.development.js +0.45% 131.37 kB 131.96 kB +0.54% 32.88 kB 33.06 kB
oss-stable-semver/react-server/cjs/react-server.production.min.js +0.41% 20.92 kB 21.01 kB +0.36% 7.18 kB 7.21 kB
oss-stable/react-server/cjs/react-server.production.min.js +0.41% 20.92 kB 21.01 kB +0.36% 7.18 kB 7.21 kB
oss-experimental/react-server/cjs/react-server.production.min.js +0.40% 21.25 kB 21.34 kB +0.44% 7.28 kB 7.31 kB
facebook-www/ReactDOMServer-prod.modern.js +0.29% 80.31 kB 80.54 kB +0.29% 16.75 kB 16.80 kB
facebook-www/ReactDOMServer-prod.classic.js +0.28% 83.24 kB 83.47 kB +0.29% 17.35 kB 17.40 kB
facebook-www/ReactDOMServerStreaming-prod.modern.js +0.28% 83.29 kB 83.52 kB +0.27% 17.56 kB 17.61 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +0.24% 35.01 kB 35.10 kB +0.22% 11.61 kB 11.64 kB
facebook-www/ReactDOMServerStreaming-dev.modern.js +0.24% 245.99 kB 246.59 kB +0.30% 58.47 kB 58.65 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +0.24% 35.04 kB 35.12 kB +0.22% 11.63 kB 11.66 kB
oss-stable-semver/react-dom/umd/react-dom-server-legacy.browser.production.min.js +0.24% 35.12 kB 35.21 kB +0.20% 11.74 kB 11.76 kB
oss-stable/react-dom/umd/react-dom-server-legacy.browser.production.min.js +0.24% 35.15 kB 35.23 kB +0.20% 11.76 kB 11.78 kB
oss-stable-semver/react-dom/umd/react-dom-server.browser.development.js +0.24% 255.03 kB 255.65 kB +0.39% 59.72 kB 59.95 kB
oss-stable/react-dom/umd/react-dom-server.browser.development.js +0.24% 255.05 kB 255.67 kB +0.38% 59.74 kB 59.97 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.development.js +0.24% 243.15 kB 243.74 kB +0.32% 59.02 kB 59.21 kB
oss-stable/react-dom/cjs/react-dom-server.browser.development.js +0.24% 243.18 kB 243.76 kB +0.31% 59.05 kB 59.24 kB
oss-stable-semver/react-dom/umd/react-dom-server-legacy.browser.development.js +0.24% 256.09 kB 256.71 kB +0.39% 59.59 kB 59.83 kB
oss-stable/react-dom/umd/react-dom-server-legacy.browser.development.js +0.24% 256.12 kB 256.73 kB +0.39% 59.62 kB 59.85 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +0.24% 35.45 kB 35.54 kB +0.23% 11.78 kB 11.80 kB
oss-experimental/react-dom/cjs/react-dom-static.browser.development.js +0.24% 244.03 kB 244.61 kB +0.31% 59.27 kB 59.45 kB
oss-experimental/react-dom/umd/react-dom-server.browser.development.js +0.24% 256.69 kB 257.31 kB +0.39% 60.14 kB 60.38 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.development.js +0.24% 244.19 kB 244.78 kB +0.33% 58.89 kB 59.08 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.development.js +0.24% 244.22 kB 244.80 kB +0.33% 58.91 kB 59.10 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.development.js +0.24% 244.35 kB 244.94 kB +0.34% 58.94 kB 59.14 kB
oss-stable/react-dom/cjs/react-dom-server.node.development.js +0.24% 244.38 kB 244.96 kB +0.32% 58.97 kB 59.16 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.development.js +0.24% 244.72 kB 245.31 kB +0.31% 59.46 kB 59.65 kB
oss-experimental/react-dom/umd/react-dom-server-legacy.browser.production.min.js +0.24% 35.57 kB 35.65 kB +0.22% 11.89 kB 11.92 kB
oss-experimental/react-dom/umd/react-dom-server-legacy.browser.development.js +0.24% 257.75 kB 258.37 kB +0.37% 60.02 kB 60.24 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.production.min.js +0.24% 35.63 kB 35.71 kB +0.13% 12.26 kB 12.27 kB
oss-stable/react-dom/cjs/react-dom-server.browser.production.min.js +0.24% 35.65 kB 35.73 kB +0.13% 12.28 kB 12.29 kB
facebook-www/ReactDOMServer-dev.modern.js +0.24% 250.42 kB 251.01 kB +0.31% 59.52 kB 59.70 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.development.js +0.24% 245.76 kB 246.35 kB +0.30% 59.34 kB 59.52 kB
oss-experimental/react-dom/cjs/react-dom-static.node.development.js +0.24% 245.88 kB 246.47 kB +0.31% 59.48 kB 59.67 kB
oss-stable-semver/react-dom/umd/react-dom-server.browser.production.min.js +0.24% 35.73 kB 35.81 kB +0.25% 12.39 kB 12.42 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.development.js +0.24% 245.90 kB 246.49 kB +0.30% 59.39 kB 59.57 kB
oss-experimental/react-dom/cjs/react-dom-server.node.development.js +0.24% 245.92 kB 246.51 kB +0.31% 59.38 kB 59.57 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.development.js +0.24% 245.93 kB 246.51 kB +0.30% 59.41 kB 59.59 kB
oss-stable/react-dom/umd/react-dom-server.browser.production.min.js +0.24% 35.75 kB 35.84 kB +0.25% 12.41 kB 12.44 kB
oss-experimental/react-dom/cjs/react-dom-static.browser.production.min.js +0.24% 35.95 kB 36.03 kB +0.20% 12.39 kB 12.42 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.development.js +0.24% 247.47 kB 248.06 kB +0.30% 59.81 kB 59.99 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.production.min.js +0.24% 36.07 kB 36.15 kB +0.21% 12.44 kB 12.46 kB
oss-experimental/react-dom/umd/react-dom-server.browser.production.min.js +0.24% 36.17 kB 36.26 kB +0.18% 12.55 kB 12.58 kB
facebook-www/ReactDOMServer-dev.classic.js +0.23% 257.07 kB 257.67 kB +0.31% 60.94 kB 61.13 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.production.min.js +0.22% 38.79 kB 38.88 kB +0.18% 12.77 kB 12.80 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.production.min.js +0.22% 38.82 kB 38.90 kB +0.18% 12.80 kB 12.82 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.production.min.js +0.22% 39.05 kB 39.13 kB +0.14% 13.29 kB 13.31 kB
oss-stable/react-dom/cjs/react-dom-server.node.production.min.js +0.22% 39.07 kB 39.16 kB +0.13% 13.32 kB 13.33 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.production.min.js +0.22% 39.29 kB 39.38 kB +0.21% 12.96 kB 12.99 kB
oss-experimental/react-dom/cjs/react-dom-static.node.production.min.js +0.22% 39.51 kB 39.59 kB +0.22% 13.47 kB 13.50 kB
oss-experimental/react-dom/cjs/react-dom-server.node.production.min.js +0.21% 39.55 kB 39.63 kB +0.16% 13.48 kB 13.50 kB

Generated by 🚫 dangerJS against b45cd19

@acdlite
Copy link
Collaborator Author

acdlite commented Jul 25, 2022

Based on an out-of-band discussion, I'm going to change this to skip server rendering hidden Offscreen trees instead

@acdlite acdlite force-pushed the add-offscreen-type-to-fizz branch from d94ad7b to 2c4502f Compare July 26, 2022 04:19
During server rendering, a visible Offscreen subtree acts exactly like a
fragment: a pure indirection.

A hidden Offscreen subtree is not server rendered at all. It's ignored
during hydration, too. Prerendering happens only on the client. We
considered prerendering hidden trees on the server, too, but our
conclusion is that it's a waste of bytes and server computation. We
can't think of any compelling cases where it's the right trade off. (If
we ever change our mind, though, the way we'll likely model it is to
treat it as if it's a Suspense boundary with an empty fallback.)
@acdlite acdlite force-pushed the add-offscreen-type-to-fizz branch from 2c4502f to b45cd19 Compare July 26, 2022 04:25
@acdlite acdlite changed the title Add Offscreen type to Fizz Implement Offscreen in Fizz Jul 26, 2022
@acdlite acdlite merged commit 2c7dea7 into facebook:main Jul 26, 2022
facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Sep 8, 2022
Summary:
This sync includes the following changes:
- **[4ea064eb0](facebook/react@4ea064eb0 )**: Don't fire passive effects during initial mount of a hidden Offscreen tree ([#24967](facebook/react#24967)) //<Andrew Clark>//
- **[2c7dea736](facebook/react@2c7dea736 )**: Implement Offscreen in Fizz ([#24988](facebook/react#24988)) //<Andrew Clark>//
- **[49f8254d6](facebook/react@49f8254d6 )**: Bug fix for <App /> vs. <Counter /> ([#24972](facebook/react#24972)) //<davidrenne>//
- **[6b28bc9c5](facebook/react@6b28bc9c5 )**: test: Throw custom error instead of relying on runtime error ([#24946](facebook/react#24946)) //<Sebastian Silbermann>//
- **[9bd0dd4c1](facebook/react@9bd0dd4c1 )**: test(react-debug-tools): Improve coverage of currentDispatcher.current setter ([#24945](facebook/react#24945)) //<Sebastian Silbermann>//
- **[59bc52a16](facebook/react@59bc52a16 )**: Add 4.5.0 release to eslint rules CHANGELOG ([#24853](facebook/react#24853)) //<Sebastian Silbermann>//
- **[cfb6cfa25](facebook/react@cfb6cfa25 )**: Reused components commit with timing as new ones //<Andrew Clark>//
- **[679eea328](facebook/react@679eea328 )**: Extract layout effects to separate functions //<Andrew Clark>//
- **[41287d447](facebook/react@41287d447 )**: Use recursion to traverse during "reappear layout" phase //<Andrew Clark>//
- **[697702bf3](facebook/react@697702bf3 )**: Use recursion to traverse during "disappear layout" phase //<Andrew Clark>//
- **[02206099a](facebook/react@02206099a )**: Use recursion to traverse during passive unmount phase ([#24918](facebook/react#24918)) //<Andrew Clark>//
- **[f62949519](facebook/react@f62949519 )**: [Transition Tracing] Rename transitionCallbacks to unstable_transitionCallbacks  ([#24920](facebook/react#24920)) //<Luna Ruan>//
- **[7a4336c40](facebook/react@7a4336c40 )**: Use recursion to traverse during passive mount phase //<Andrew Clark>//
- **[bb1357b38](facebook/react@bb1357b38 )**: Wrap try-catch directly around each user function //<Andrew Clark>//
- **[de3c06984](facebook/react@de3c06984 )**: Move flag check into each switch case //<Andrew Clark>//
- **[f5916d15b](facebook/react@f5916d15b )**: [Transition Tracing][Code Cleanup] Delete Marker Name Change Tests ([#24908](facebook/react#24908)) //<Luna Ruan>//
- **[fa20b319f](facebook/react@fa20b319f )**: [Transition Tracing] Code Cleanup ([#24880](facebook/react#24880)) //<Luna Ruan>//
- **[5e8c1961c](facebook/react@5e8c1961c )**: [Transition Tracing] onMarkerProgress ([#24861](facebook/react#24861)) //<Luna Ruan>//
- **[b641d0209](facebook/react@b641d0209 )**: Use recursion to traverse during layout phase //<Andrew Clark>//
- **[a1b1e391e](facebook/react@a1b1e391e )**: Wrap try-catch directly around each user function //<Andrew Clark>//
- **[3df7e8f5d](facebook/react@3df7e8f5d )**: Move flag check into each switch case //<Andrew Clark>//
- **[b8c96b136](facebook/react@b8c96b136 )**: Move ref commit effects inside switch statement //<Andrew Clark>//
- **[e225fa43a](facebook/react@e225fa43a )**: [Transition Tracing] Don't call transition callbacks if no transition name specified ([#24887](facebook/react#24887)) //<Luna Ruan>//
- **[dd2d65227](facebook/react@dd2d65227 )**: [Transition Tracing] Tracing Marker Name Change in Update Warning ([#24873](facebook/react#24873)) //<Luna Ruan>//
- **[80208e769](facebook/react@80208e769 )**: [Transition Tracing] Add onTransitionProgress Callback ([#24833](facebook/react#24833)) //<Luna Ruan>//
- **[30eb267ab](facebook/react@30eb267ab )**: Land forked reconciler changes ([#24878](facebook/react#24878)) //<Andrew Clark>//
- **[5e4e2dae0](facebook/react@5e4e2dae0 )**: Defer setState callbacks until component is visible ([#24872](facebook/react#24872)) //<Andrew Clark>//
- **[8e35b5060](facebook/react@8e35b5060 )**: [Transition Tracing] Refactor Code to Remove OffscreeInstance TODOs ([#24855](facebook/react#24855)) //<Luna Ruan>//
- **[deab1263a](facebook/react@deab1263a )**: [Transition Tracing] Change Transition Type Passed Pending Transitions ([#24856](facebook/react#24856)) //<Luna Ruan>//
- **[82e9e9909](facebook/react@82e9e9909 )**: Suspending inside a hidden tree should not cause fallbacks to appear ([#24699](facebook/react#24699)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions c1f5884...4ea064e

jest_e2e[run_all_tests]

Reviewed By: philIip, NickGerleman

Differential Revision: D39305648

fbshipit-source-id: 627ead5035c77fbc902b306e17897e425ad7fb99
rickhanlonii pushed a commit that referenced this pull request Oct 6, 2022
During server rendering, a visible Offscreen subtree acts exactly like a
fragment: a pure indirection.

A hidden Offscreen subtree is not server rendered at all. It's ignored
during hydration, too. Prerendering happens only on the client. We
considered prerendering hidden trees on the server, too, but our
conclusion is that it's a waste of bytes and server computation. We
can't think of any compelling cases where it's the right trade off. (If
we ever change our mind, though, the way we'll likely model it is to
treat it as if it's a Suspense boundary with an empty fallback.)
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
Summary:
This sync includes the following changes:
- **[4ea064eb0](facebook/react@4ea064eb0 )**: Don't fire passive effects during initial mount of a hidden Offscreen tree ([facebook#24967](facebook/react#24967)) //<Andrew Clark>//
- **[2c7dea736](facebook/react@2c7dea736 )**: Implement Offscreen in Fizz ([facebook#24988](facebook/react#24988)) //<Andrew Clark>//
- **[49f8254d6](facebook/react@49f8254d6 )**: Bug fix for <App /> vs. <Counter /> ([facebook#24972](facebook/react#24972)) //<davidrenne>//
- **[6b28bc9c5](facebook/react@6b28bc9c5 )**: test: Throw custom error instead of relying on runtime error ([facebook#24946](facebook/react#24946)) //<Sebastian Silbermann>//
- **[9bd0dd4c1](facebook/react@9bd0dd4c1 )**: test(react-debug-tools): Improve coverage of currentDispatcher.current setter ([facebook#24945](facebook/react#24945)) //<Sebastian Silbermann>//
- **[59bc52a16](facebook/react@59bc52a16 )**: Add 4.5.0 release to eslint rules CHANGELOG ([facebook#24853](facebook/react#24853)) //<Sebastian Silbermann>//
- **[cfb6cfa25](facebook/react@cfb6cfa25 )**: Reused components commit with timing as new ones //<Andrew Clark>//
- **[679eea328](facebook/react@679eea328 )**: Extract layout effects to separate functions //<Andrew Clark>//
- **[41287d447](facebook/react@41287d447 )**: Use recursion to traverse during "reappear layout" phase //<Andrew Clark>//
- **[697702bf3](facebook/react@697702bf3 )**: Use recursion to traverse during "disappear layout" phase //<Andrew Clark>//
- **[02206099a](facebook/react@02206099a )**: Use recursion to traverse during passive unmount phase ([facebook#24918](facebook/react#24918)) //<Andrew Clark>//
- **[f62949519](facebook/react@f62949519 )**: [Transition Tracing] Rename transitionCallbacks to unstable_transitionCallbacks  ([facebook#24920](facebook/react#24920)) //<Luna Ruan>//
- **[7a4336c40](facebook/react@7a4336c40 )**: Use recursion to traverse during passive mount phase //<Andrew Clark>//
- **[bb1357b38](facebook/react@bb1357b38 )**: Wrap try-catch directly around each user function //<Andrew Clark>//
- **[de3c06984](facebook/react@de3c06984 )**: Move flag check into each switch case //<Andrew Clark>//
- **[f5916d15b](facebook/react@f5916d15b )**: [Transition Tracing][Code Cleanup] Delete Marker Name Change Tests ([facebook#24908](facebook/react#24908)) //<Luna Ruan>//
- **[fa20b319f](facebook/react@fa20b319f )**: [Transition Tracing] Code Cleanup ([facebook#24880](facebook/react#24880)) //<Luna Ruan>//
- **[5e8c1961c](facebook/react@5e8c1961c )**: [Transition Tracing] onMarkerProgress ([facebook#24861](facebook/react#24861)) //<Luna Ruan>//
- **[b641d0209](facebook/react@b641d0209 )**: Use recursion to traverse during layout phase //<Andrew Clark>//
- **[a1b1e391e](facebook/react@a1b1e391e )**: Wrap try-catch directly around each user function //<Andrew Clark>//
- **[3df7e8f5d](facebook/react@3df7e8f5d )**: Move flag check into each switch case //<Andrew Clark>//
- **[b8c96b136](facebook/react@b8c96b136 )**: Move ref commit effects inside switch statement //<Andrew Clark>//
- **[e225fa43a](facebook/react@e225fa43a )**: [Transition Tracing] Don't call transition callbacks if no transition name specified ([facebook#24887](facebook/react#24887)) //<Luna Ruan>//
- **[dd2d65227](facebook/react@dd2d65227 )**: [Transition Tracing] Tracing Marker Name Change in Update Warning ([facebook#24873](facebook/react#24873)) //<Luna Ruan>//
- **[80208e769](facebook/react@80208e769 )**: [Transition Tracing] Add onTransitionProgress Callback ([facebook#24833](facebook/react#24833)) //<Luna Ruan>//
- **[30eb267ab](facebook/react@30eb267ab )**: Land forked reconciler changes ([facebook#24878](facebook/react#24878)) //<Andrew Clark>//
- **[5e4e2dae0](facebook/react@5e4e2dae0 )**: Defer setState callbacks until component is visible ([facebook#24872](facebook/react#24872)) //<Andrew Clark>//
- **[8e35b5060](facebook/react@8e35b5060 )**: [Transition Tracing] Refactor Code to Remove OffscreeInstance TODOs ([facebook#24855](facebook/react#24855)) //<Luna Ruan>//
- **[deab1263a](facebook/react@deab1263a )**: [Transition Tracing] Change Transition Type Passed Pending Transitions ([facebook#24856](facebook/react#24856)) //<Luna Ruan>//
- **[82e9e9909](facebook/react@82e9e9909 )**: Suspending inside a hidden tree should not cause fallbacks to appear ([facebook#24699](facebook/react#24699)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions c1f5884...4ea064e

jest_e2e[run_all_tests]

Reviewed By: philIip, NickGerleman

Differential Revision: D39305648

fbshipit-source-id: 627ead5035c77fbc902b306e17897e425ad7fb99
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