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

[Partial Hydration] Render client-only content at normal priority #15061

Merged
merged 5 commits into from
Mar 11, 2019

Conversation

sebmarkbage
Copy link
Collaborator

@sebmarkbage sebmarkbage commented Mar 8, 2019

If the dehydrated suspense boundary's fallback content is terminal there is nothing to show. We need to get actual content on the screen soon.

If we deprioritize that work to offscreen, then the timeout heuristics will be wrong.

Therefore, if we have no current and we're already at terminal fallback state we'll immediately schedule a deletion and upgrade to real suspense.

Ideally, if we're in a pending state, we should also just register the listener instead of retrying at offscreen, but meh.

The first commit is from another branch I needed to factor out but might as well include it here.

These will need different logic. In this commit, no logic has changed,
only moved.
If the dehydrated suspense boundary's fallback content is terminal there
is nothing to show. We need to get actual content on the screen soon.

If we deprioritize that work to offscreen, then the timeout heuristics will
be wrong.

Therefore, if we have no current and we're already at terminal fallback
state we'll immediately schedule a deletion and upgrade to real suspense.
@sizebot
Copy link

sizebot commented Mar 8, 2019

Details of bundled changes.

Comparing: d0289c7...bc068d6

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js +0.2% +0.2% 775.58 KB 777.04 KB 176.45 KB 176.86 KB UMD_DEV
react-dom.profiling.min.js 0.0% -0.0% 107.9 KB 107.9 KB 34.72 KB 34.72 KB UMD_PROFILING
react-dom.development.js +0.2% +0.2% 769.97 KB 771.43 KB 174.94 KB 175.35 KB NODE_DEV
react-dom.production.min.js 0.0% -0.0% 104.87 KB 104.87 KB 33.53 KB 33.53 KB NODE_PROD
ReactDOM-dev.js +0.2% +0.2% 792.88 KB 794.38 KB 176.09 KB 176.52 KB FB_WWW_DEV
ReactDOM-prod.js 🔺+0.1% 🔺+0.2% 320.99 KB 321.43 KB 58.8 KB 58.89 KB FB_WWW_PROD
ReactDOM-profiling.js +0.1% +0.1% 326.93 KB 327.37 KB 60.08 KB 60.17 KB FB_WWW_PROFILING
react-dom-unstable-fire.development.js +0.2% +0.2% 775.92 KB 777.39 KB 176.59 KB 177 KB UMD_DEV
react-dom-unstable-fire.development.js +0.2% +0.2% 770.31 KB 771.78 KB 175.08 KB 175.48 KB NODE_DEV
react-dom-unstable-fire.production.min.js 0.0% -0.0% 104.89 KB 104.89 KB 33.54 KB 33.54 KB NODE_PROD
react-dom-unstable-fire.profiling.min.js 0.0% -0.0% 108 KB 108 KB 34.18 KB 34.18 KB NODE_PROFILING
ReactFire-dev.js +0.2% +0.2% 792.09 KB 793.59 KB 176.05 KB 176.48 KB FB_WWW_DEV
ReactFire-prod.js 🔺+0.1% 🔺+0.2% 309.53 KB 309.97 KB 56.44 KB 56.54 KB FB_WWW_PROD
ReactFire-profiling.js +0.1% +0.2% 315.55 KB 316 KB 57.72 KB 57.81 KB FB_WWW_PROFILING
react-dom-test-utils.production.min.js 0.0% -0.0% 10.27 KB 10.27 KB 3.8 KB 3.8 KB UMD_PROD
react-dom-test-utils.production.min.js 0.0% -0.0% 10.05 KB 10.05 KB 3.73 KB 3.73 KB NODE_PROD
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.0% 11.01 KB 11.01 KB 3.81 KB 3.81 KB UMD_PROD
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 60.28 KB 60.28 KB 15.79 KB 15.79 KB NODE_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.0% 10.75 KB 10.75 KB 3.71 KB 3.71 KB NODE_PROD
ReactDOMServer-prod.js 0.0% -0.0% 45.27 KB 45.27 KB 10.43 KB 10.43 KB FB_WWW_PROD
react-dom-server.node.production.min.js 0.0% -0.0% 19.69 KB 19.69 KB 7.52 KB 7.52 KB NODE_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.1% 1.21 KB 1.21 KB 706 B 705 B UMD_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.2% 1.05 KB 1.05 KB 637 B 636 B NODE_PROD
react-dom-unstable-fizz.node.development.js 0.0% -0.1% 3.7 KB 3.7 KB 1.42 KB 1.42 KB NODE_DEV
react-dom-unstable-fizz.node.production.min.js 0.0% -0.3% 1.1 KB 1.1 KB 668 B 666 B NODE_PROD

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js +0.3% +0.4% 551.25 KB 552.71 KB 119.63 KB 120.06 KB UMD_DEV
react-art.production.min.js 0.0% -0.0% 96.91 KB 96.91 KB 29.88 KB 29.88 KB UMD_PROD
react-art.development.js +0.3% +0.4% 482.14 KB 483.6 KB 102.34 KB 102.74 KB NODE_DEV
react-art.production.min.js 0.0% -0.0% 61.83 KB 61.83 KB 18.99 KB 18.99 KB NODE_PROD
ReactART-dev.js +0.3% +0.4% 491.35 KB 492.84 KB 101.58 KB 102 KB FB_WWW_DEV
ReactART-prod.js 🔺+0.2% 🔺+0.2% 194.9 KB 195.32 KB 33.1 KB 33.18 KB FB_WWW_PROD

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-dev.js +0.2% +0.3% 617.14 KB 618.64 KB 131.86 KB 132.3 KB RN_FB_DEV
ReactNativeRenderer-profiling.js 0.0% -0.0% 251.82 KB 251.82 KB 44.34 KB 44.34 KB RN_FB_PROFILING
ReactNativeRenderer-dev.js +0.2% +0.3% 617.05 KB 618.55 KB 131.82 KB 132.26 KB RN_OSS_DEV
ReactNativeRenderer-profiling.js 0.0% -0.0% 251.84 KB 251.84 KB 44.34 KB 44.34 KB RN_OSS_PROFILING
ReactFabric-dev.js +0.2% +0.3% 607.99 KB 609.49 KB 129.58 KB 130.01 KB RN_FB_DEV
ReactFabric-prod.js 0.0% -0.0% 238.78 KB 238.78 KB 41.52 KB 41.52 KB RN_FB_PROD
ReactFabric-profiling.js 0.0% 0.0% 244.16 KB 244.16 KB 42.88 KB 42.88 KB RN_FB_PROFILING
ReactFabric-dev.js +0.2% +0.3% 607.9 KB 609.4 KB 129.53 KB 129.96 KB RN_OSS_DEV
ReactFabric-prod.js 0.0% 0.0% 238.78 KB 238.78 KB 41.52 KB 41.52 KB RN_OSS_PROD
ReactFabric-profiling.js 0.0% 0.0% 244.17 KB 244.17 KB 42.87 KB 42.87 KB RN_OSS_PROFILING

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js +0.3% +0.4% 491.18 KB 492.64 KB 104.05 KB 104.44 KB UMD_DEV
react-test-renderer.production.min.js 0.0% -0.0% 62.91 KB 62.91 KB 19.33 KB 19.33 KB UMD_PROD
react-test-renderer.development.js +0.3% +0.4% 486.7 KB 488.16 KB 102.89 KB 103.3 KB NODE_DEV
react-test-renderer.production.min.js 0.0% -0.0% 62.56 KB 62.56 KB 19.07 KB 19.07 KB NODE_PROD
ReactTestRenderer-dev.js +0.3% +0.4% 496.72 KB 498.22 KB 102.52 KB 102.95 KB FB_WWW_DEV
react-test-renderer-shallow.production.min.js 0.0% 0.0% 11.12 KB 11.12 KB 3.35 KB 3.35 KB UMD_PROD
react-test-renderer-shallow.production.min.js 0.0% 0.0% 11.77 KB 11.77 KB 3.65 KB 3.65 KB NODE_PROD

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler.development.js +0.3% +0.4% 480.33 KB 481.8 KB 100.86 KB 101.26 KB NODE_DEV
react-reconciler.production.min.js -0.1% 0.0% 63 KB 62.96 KB 18.84 KB 18.85 KB NODE_PROD
react-reconciler-persistent.development.js +0.3% +0.4% 478.53 KB 480 KB 100.15 KB 100.55 KB NODE_DEV
react-reconciler-persistent.production.min.js -0.1% 0.0% 63.01 KB 62.97 KB 18.85 KB 18.85 KB NODE_PROD
react-reconciler-reflection.development.js 0.0% -0.0% 15.76 KB 15.76 KB 4.98 KB 4.98 KB NODE_DEV

Generated by 🚫 dangerJS

@sebmarkbage sebmarkbage changed the title Delete terminal fallback content in first pass [Partial Hydration] Delete terminal fallback content in first pass Mar 8, 2019
@sebmarkbage
Copy link
Collaborator Author

I think this is still a problem if there is one more suspense boundary around this which has content. In that scenario that boundary will hydrate at offscreen and the same thing happens.

@sebmarkbage
Copy link
Collaborator Author

There is a conflict between our normal heuristic that dehydrated boundaries should be hydrated at offscreen priority. We can do that because there is no reason to hydrate content faster than that if it’s already being displayed.

However if there is nested fallback content that can only be displayed by client rendering it which has higher pri. But we can’t get there unless we first render the parent which is lower pri.

@sebmarkbage
Copy link
Collaborator Author

The new approach just schedules the client content at higher pri once it gets there. It means that it can be delayed compared to when it would normally be rendered but that seems fine. That only happens if you start interacting anyway.

This is kind of non-idiomatic anyway because you’re expected to server render everything in the normal case.

@sebmarkbage sebmarkbage changed the title [Partial Hydration] Delete terminal fallback content in first pass [Partial Hydration] Render client-only content at normal priority Mar 9, 2019
@sebmarkbage sebmarkbage merged commit 5d0c3c6 into facebook:master Mar 11, 2019
@gaearon gaearon mentioned this pull request Apr 20, 2019
63 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants