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

[Selective Hydration] Prioritize the last continuous target #16937

Merged
merged 2 commits into from
Oct 2, 2019

Conversation

sebmarkbage
Copy link
Collaborator

This ensures that the current focus target is always hydrated first.

Slightly higher than the usual Never expiration time used for hydration. The priority increases with each new queued item so that the last always wins.

This is mostly to ensure that tooltips show up at a reasonable time.

If there's client rendered content that currently comes first though.

@sizebot
Copy link

sizebot commented Sep 28, 2019

ReactDOM: size: 0.0%, gzip: 0.0%

Details of bundled changes.

Comparing: 10277cc...cc67c72

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.profiling.min.js +0.1% 0.0% 121.06 KB 121.24 KB 38.19 KB 38.2 KB NODE_PROFILING
ReactDOM-dev.js +0.2% +0.1% 976.14 KB 977.78 KB 216.54 KB 216.85 KB FB_WWW_DEV
react-dom-server.browser.production.min.js 0.0% 0.0% 19.86 KB 19.86 KB 7.37 KB 7.38 KB UMD_PROD
react-dom-unstable-fizz.browser.development.js 0.0% -0.1% 3.78 KB 3.78 KB 1.53 KB 1.53 KB UMD_DEV
react-dom-test-utils.production.min.js 0.0% 0.0% 11.19 KB 11.19 KB 4.16 KB 4.16 KB UMD_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.1% 1.2 KB 1.2 KB 702 B 701 B UMD_PROD
react-dom-unstable-fizz.browser.development.js 0.0% -0.1% 3.61 KB 3.61 KB 1.48 KB 1.48 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% 0.0% 10.96 KB 10.96 KB 4.09 KB 4.09 KB NODE_PROD
react-dom.development.js +0.2% +0.1% 951.68 KB 953.32 KB 215.43 KB 215.72 KB UMD_DEV
react-dom.production.min.js 🔺+0.1% 🔺+0.1% 117.31 KB 117.48 KB 37.83 KB 37.88 KB UMD_PROD
react-dom.profiling.min.js +0.1% +0.2% 120.85 KB 121.02 KB 38.86 KB 38.94 KB UMD_PROFILING
react-dom.development.js +0.2% +0.1% 945.72 KB 947.37 KB 213.88 KB 214.17 KB NODE_DEV
react-dom-server.node.development.js 0.0% -0.0% 137.88 KB 137.88 KB 36.15 KB 36.15 KB NODE_DEV
react-dom.production.min.js 🔺+0.1% 🔺+0.1% 117.42 KB 117.59 KB 37.15 KB 37.2 KB NODE_PROD
ReactDOM-prod.js 🔺+0.2% 🔺+0.1% 400 KB 400.77 KB 73.05 KB 73.15 KB FB_WWW_PROD
ReactDOM-profiling.js +0.2% +0.1% 400.81 KB 401.59 KB 73.56 KB 73.66 KB FB_WWW_PROFILING
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 60.53 KB 60.53 KB 15.84 KB 15.84 KB UMD_DEV
ReactDOMServer-prod.js 0.0% 0.0% 48.24 KB 48.24 KB 11.04 KB 11.04 KB FB_WWW_PROD
react-dom-unstable-native-dependencies.production.min.js 0.0% 0.0% 10.49 KB 10.49 KB 3.57 KB 3.57 KB NODE_PROD

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler.development.js +0.2% +0.2% 600.32 KB 601.31 KB 127.22 KB 127.44 KB NODE_DEV
react-reconciler.production.min.js 🔺+0.1% 🔺+0.1% 71.63 KB 71.72 KB 21.21 KB 21.24 KB NODE_PROD
react-reconciler-reflection.production.min.js 0.0% 🔺+0.1% 2.88 KB 2.88 KB 1.25 KB 1.25 KB NODE_PROD
react-reconciler-persistent.development.js +0.2% +0.2% 597.49 KB 598.49 KB 126.03 KB 126.25 KB NODE_DEV
react-reconciler-persistent.production.min.js 🔺+0.1% 🔺+0.1% 71.64 KB 71.73 KB 21.22 KB 21.24 KB NODE_PROD

Generated by 🚫 dangerJS against cc67c72

Copy link
Contributor

@bvaughn bvaughn left a comment

Choose a reason for hiding this comment

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

In general this looks pretty neat 👍

]);

document.body.removeChild(container);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice test 👍

@@ -421,6 +425,19 @@ export function attemptUserBlockingHydration(fiber: Fiber): void {
markRetryTimeIfNotHydrated(fiber, expTime);
}

export function attemptContinuousHydration(fiber: Fiber): void {
if (fiber.tag !== SuspenseComponent) {
// We ignore HostRoots here because we can't increase
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment seems to have been copy-pasted from above- but I'm not sure I understand why we specifically mention the HostRoot type here, since we are ignoring everything other than SuspenseComponent. Ah, I was missing the context of how attemptToDispatchEvent() worked.

packages/react-reconciler/src/ReactFiberExpirationTime.js Outdated Show resolved Hide resolved
This ensures that the current focus target is always hydrated first.

Slightly higher than the usual Never expiration time used for hydration.
The priority increases with each new queued item so that the last always
wins.
It's not useful for comparison purposes anyway.
@sebmarkbage sebmarkbage merged commit bb680a0 into facebook:master Oct 2, 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.

None yet

4 participants