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

Idle updates should not be blocked by hidden work #16871

Merged
merged 3 commits into from
Sep 24, 2019

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Sep 24, 2019

Use the special Idle expiration time for updates that are triggered at Scheduler's IdlePriority, instead of Never.

The key difference between Idle and Never¹ is that Never work can be committed in an inconsistent state without tearing the UI. The main example is offscreen content, like a hidden subtree.

¹ "Never" isn't the best name. I originally called it that because it "never" expires, but neither does Idle. Since it's mostly used for offscreen subtrees, we could call it "Offscreen." However, it's also used for dehydrated Suspense boundaries, which are inconsistent in the sense that they haven't finished yet, but aren't visibly inconsistent because the server rendered HTML matches what the hydrated tree would look like.

Use the special `Idle` expiration time for updates that are triggered at
Scheduler's `IdlePriority`, instead of `Never`.

The key difference between Idle and Never¹ is that Never work can be
committed in an inconsistent state without tearing the UI. The main
example is offscreen content, like a hidden subtree.

¹ "Never" isn't the best name. I originally called it that because it
"never" expires, but neither does Idle. Since it's mostly used for
offscreen subtrees, we could call it "Offscreen." However, it's also
used for dehydrated Suspense boundaries, which are inconsistent in the
sense that they haven't finished yet, but aren't visibly inconsistent
because the server rendered HTML matches what the hydrated tree would
look like.
@sizebot
Copy link

sizebot commented Sep 24, 2019

Details of bundled changes.

Comparing: c5e7190...7ee2a58

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js +0.1% +0.2% 671.87 KB 672.45 KB 145.55 KB 145.81 KB UMD_DEV
react-art.production.min.js -0.0% 0.0% 103.87 KB 103.86 KB 31.62 KB 31.62 KB UMD_PROD
react-art.development.js +0.1% +0.2% 602.5 KB 603.08 KB 128.13 KB 128.39 KB NODE_DEV
react-art.production.min.js -0.0% 0.0% 68.88 KB 68.87 KB 20.86 KB 20.86 KB NODE_PROD
ReactART-dev.js +0.1% +0.2% 618.08 KB 618.66 KB 127.99 KB 128.25 KB FB_WWW_DEV
ReactART-prod.js -0.1% -0.0% 231.82 KB 231.68 KB 39.22 KB 39.21 KB FB_WWW_PROD

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.profiling.min.js 0.0% 0.0% 120.77 KB 120.78 KB 38.01 KB 38.02 KB NODE_PROFILING
react-dom-server.browser.development.js 0.0% 0.0% 142.17 KB 142.17 KB 37.13 KB 37.14 KB UMD_DEV
ReactDOM-dev.js +0.1% +0.1% 978.23 KB 978.82 KB 215.83 KB 216.11 KB FB_WWW_DEV
react-dom-test-utils.development.js 0.0% -0.0% 57.46 KB 57.46 KB 15.82 KB 15.82 KB UMD_DEV
react-dom-test-utils.production.min.js 0.0% 🔺+0.1% 11.19 KB 11.19 KB 4.16 KB 4.16 KB UMD_PROD
react-dom-test-utils.development.js 0.0% -0.0% 55.74 KB 55.74 KB 15.49 KB 15.49 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% 🔺+0.1% 10.96 KB 10.96 KB 4.09 KB 4.09 KB NODE_PROD
react-dom.development.js +0.1% +0.1% 952.72 KB 953.31 KB 214.87 KB 215.12 KB UMD_DEV
react-dom.production.min.js -0.0% 0.0% 117.08 KB 117.07 KB 37.68 KB 37.7 KB UMD_PROD
react-dom.profiling.min.js 0.0% 0.0% 120.6 KB 120.61 KB 38.7 KB 38.71 KB UMD_PROFILING
react-dom.development.js +0.1% +0.1% 946.77 KB 947.35 KB 213.33 KB 213.58 KB NODE_DEV
react-dom-server.node.development.js 0.0% 0.0% 139.12 KB 139.12 KB 36.36 KB 36.36 KB NODE_DEV
react-dom.production.min.js -0.0% -0.0% 117.1 KB 117.09 KB 36.96 KB 36.96 KB NODE_PROD
react-dom-server.node.production.min.js 0.0% 0.0% 20.2 KB 20.2 KB 7.52 KB 7.52 KB NODE_PROD
ReactDOM-prod.js -0.0% -0.0% 393.61 KB 393.47 KB 71.6 KB 71.59 KB FB_WWW_PROD
ReactDOM-profiling.js 0.0% 0.0% 399.72 KB 399.77 KB 72.68 KB 72.7 KB FB_WWW_PROFILING
react-dom-server.browser.development.js 0.0% 0.0% 138.1 KB 138.1 KB 36.13 KB 36.13 KB NODE_DEV
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 60.4 KB 60.4 KB 15.73 KB 15.73 KB NODE_DEV
react-dom-unstable-fizz.node.development.js 0.0% -0.1% 3.87 KB 3.87 KB 1.51 KB 1.51 KB NODE_DEV
react-dom-unstable-fizz.node.production.min.js 0.0% 🔺+0.2% 1.1 KB 1.1 KB 666 B 667 B NODE_PROD

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactTestRenderer-dev.js +0.1% +0.2% 629.02 KB 629.61 KB 130.39 KB 130.63 KB FB_WWW_DEV
react-test-renderer-shallow.development.js 0.0% -0.0% 39.28 KB 39.28 KB 9.97 KB 9.97 KB UMD_DEV
react-test-renderer.development.js +0.1% +0.2% 615.91 KB 616.49 KB 130.93 KB 131.17 KB UMD_DEV
react-test-renderer.production.min.js -0.0% 0.0% 70.8 KB 70.79 KB 21.65 KB 21.65 KB UMD_PROD
react-test-renderer.development.js +0.1% +0.2% 611.18 KB 611.76 KB 129.73 KB 129.99 KB NODE_DEV
react-test-renderer.production.min.js -0.0% 🔺+0.1% 70.51 KB 70.5 KB 21.35 KB 21.36 KB NODE_PROD

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler.development.js +0.1% +0.2% 601.26 KB 601.84 KB 126.84 KB 127.1 KB NODE_DEV
react-reconciler.production.min.js -0.0% 0.0% 71.22 KB 71.21 KB 21.03 KB 21.04 KB NODE_PROD
react-reconciler-persistent.development.js +0.1% +0.2% 598.27 KB 598.85 KB 125.58 KB 125.84 KB NODE_DEV
react-reconciler-persistent.production.min.js -0.0% 0.0% 71.23 KB 71.22 KB 21.04 KB 21.04 KB NODE_PROD

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-prod.js -0.0% -0.0% 275.91 KB 275.77 KB 47.19 KB 47.18 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js 0.0% 0.0% 285.44 KB 285.49 KB 48.86 KB 48.88 KB RN_OSS_PROFILING
ReactFabric-prod.js -0.1% -0.0% 267.67 KB 267.53 KB 45.79 KB 45.78 KB RN_OSS_PROD
ReactFabric-profiling.js 0.0% 0.0% 277.62 KB 277.67 KB 47.57 KB 47.59 KB RN_OSS_PROFILING
ReactFabric-dev.js +0.1% +0.2% 757.32 KB 757.9 KB 159.6 KB 159.86 KB RN_FB_DEV
ReactFabric-prod.js -0.1% -0.0% 267.67 KB 267.53 KB 45.8 KB 45.79 KB RN_FB_PROD
ReactNativeRenderer-dev.js +0.1% +0.2% 750.71 KB 751.3 KB 158.42 KB 158.69 KB RN_OSS_DEV
ReactFabric-profiling.js 0.0% 0.0% 277.62 KB 277.67 KB 47.58 KB 47.6 KB RN_FB_PROFILING
ReactNativeRenderer-dev.js +0.1% +0.2% 750.87 KB 751.46 KB 158.5 KB 158.76 KB RN_FB_DEV
ReactNativeRenderer-prod.js -0.0% -0.0% 275.91 KB 275.77 KB 47.19 KB 47.19 KB RN_FB_PROD
ReactNativeRenderer-profiling.js 0.0% 0.0% 285.43 KB 285.48 KB 48.87 KB 48.88 KB RN_FB_PROFILING
ReactFabric-dev.js +0.1% +0.2% 757.15 KB 757.74 KB 159.51 KB 159.78 KB RN_OSS_DEV

Generated by 🚫 dangerJS against 7ee2a58

I had made them Never to avoid an extra render when a hidden effect
updates the hidden component -- if they are Idle, we have to render once
at Idle, which bails out on the hidden subtree, then again at Never to
actually process the update -- but the problem of needing an extra
render pass to bail out hidden updates already exists and we should fix
that properly instead of adding yet another special case.
@acdlite acdlite merged commit 8b580a8 into facebook:master Sep 24, 2019
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