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

Wrap retrySuspendedRoot using SchedulerTracing #13776

Merged
merged 2 commits into from Oct 4, 2018

Conversation

sophiebits
Copy link
Collaborator

Previously, we were emptying root.pendingInteractionMap and permanently losing those interactions when applying an unrelated update to a tree that has no scheduled work that is waiting on promise resolution. (That is, one that is showing a fallback and waiting for the suspended content to resolve.)

The logic I'm leaving untouched with nextRenderIncludesTimedOutPlaceholder is not correct -- what we want is instead to know if any placeholder anywhere in the tree is showing its fallback -- but we don't currently have a better replacement, and this should unblock tracing with suspense again.

@@ -2631,6 +2646,11 @@ describe('Profiler', () => {
},
);
});
expect(ReactTestRenderer).toHaveYielded([
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The timing of these yields is unchanged; the old test was misleading.

expect(renderer).toFlushAndYield(['AsyncText [loaded]']);
expect(renderer.toJSON()).toEqual(['loaded', 'updated']);

expect(onRender).toHaveBeenCalledTimes(1);
expect(onRender.mock.calls[0][6]).toMatchInteractions([
initialRenderInteraction,
highPriUpdateInteraction,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The way this test changed is a little interesting. Our "hi-pri update" causes us to re-call AsyncText which means that in a sense, the update now is blocked on the suspended component before it fully resolves. I can see the argument either way for how to account for this. The good news is that if we only scheduled an update on the sibling then they would stay independent.

@sizebot
Copy link

sizebot commented Oct 4, 2018

ReactDOM: size: 0.0%, gzip: 0.0%

Details of bundled changes.

Comparing: 40a521a...f9f43af

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js -0.2% -0.2% 658.51 KB 657.33 KB 153.88 KB 153.57 KB UMD_DEV
react-dom.production.min.js 0.0% 0.0% 93.28 KB 93.29 KB 30.35 KB 30.35 KB UMD_PROD
react-dom.development.js -0.2% -0.2% 653.85 KB 652.68 KB 152.49 KB 152.19 KB NODE_DEV
react-dom.production.min.js 0.0% -0.0% 93.27 KB 93.28 KB 29.96 KB 29.95 KB NODE_PROD
ReactDOM-dev.js -0.2% -0.2% 670.77 KB 669.61 KB 153.09 KB 152.8 KB FB_WWW_DEV
ReactDOM-prod.js 0.0% 🔺+0.1% 287.37 KB 287.48 KB 52.8 KB 52.84 KB FB_WWW_PROD
react-dom.profiling.min.js -0.0% -0.0% 96.26 KB 96.25 KB 30.58 KB 30.57 KB NODE_PROFILING
ReactDOM-profiling.js -0.1% -0.1% 294.06 KB 293.66 KB 54.23 KB 54.19 KB FB_WWW_PROFILING
react-dom.profiling.min.js -0.0% -0.0% 96.19 KB 96.18 KB 31.02 KB 31.01 KB UMD_PROFILING

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js -0.3% -0.3% 448.46 KB 447.28 KB 100.3 KB 100.01 KB UMD_DEV
react-art.production.min.js 0.0% 0.0% 85.71 KB 85.72 KB 26.21 KB 26.21 KB UMD_PROD
react-art.development.js -0.3% -0.3% 380.23 KB 379.06 KB 83.12 KB 82.83 KB NODE_DEV
react-art.production.min.js 0.0% -0.0% 50.68 KB 50.69 KB 15.48 KB 15.48 KB NODE_PROD
ReactART-dev.js -0.3% -0.4% 383.92 KB 382.76 KB 81.53 KB 81.22 KB FB_WWW_DEV
ReactART-prod.js 🔺+0.1% 🔺+0.1% 163.01 KB 163.12 KB 27.41 KB 27.44 KB FB_WWW_PROD

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.3% 392.45 KB 391.27 KB 85.71 KB 85.42 KB UMD_DEV
react-test-renderer.production.min.js 0.0% 0.0% 51.91 KB 51.92 KB 15.77 KB 15.78 KB UMD_PROD
react-test-renderer.development.js -0.3% -0.3% 388.02 KB 386.85 KB 84.59 KB 84.3 KB NODE_DEV
react-test-renderer.production.min.js 0.0% 0.0% 51.63 KB 51.64 KB 15.58 KB 15.59 KB NODE_PROD
ReactTestRenderer-dev.js -0.3% -0.4% 392.12 KB 390.96 KB 83.37 KB 83.07 KB FB_WWW_DEV

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler.development.js -0.3% -0.4% 376.06 KB 374.89 KB 81.22 KB 80.93 KB NODE_DEV
react-reconciler.production.min.js 0.0% 0.0% 50.37 KB 50.38 KB 15.02 KB 15.02 KB NODE_PROD
react-reconciler-persistent.development.js -0.3% -0.4% 374.63 KB 373.45 KB 80.63 KB 80.34 KB NODE_DEV
react-reconciler-persistent.production.min.js 0.0% 0.0% 50.38 KB 50.39 KB 15.03 KB 15.03 KB NODE_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% 508.14 KB 506.98 KB 112.17 KB 111.87 KB RN_FB_DEV
ReactNativeRenderer-prod.js 0.0% 🔺+0.1% 218.08 KB 218.19 KB 37.81 KB 37.84 KB RN_FB_PROD
ReactNativeRenderer-dev.js -0.2% -0.3% 507.84 KB 506.67 KB 112.08 KB 111.79 KB RN_OSS_DEV
ReactNativeRenderer-prod.js -0.1% -0.0% 208.31 KB 208.2 KB 36.26 KB 36.25 KB RN_OSS_PROD
ReactFabric-dev.js -0.2% -0.3% 498.29 KB 497.13 KB 109.73 KB 109.44 KB RN_FB_DEV
ReactFabric-prod.js -0.1% -0.0% 200.75 KB 200.63 KB 34.79 KB 34.78 KB RN_FB_PROD
ReactFabric-dev.js -0.2% -0.3% 498.32 KB 497.16 KB 109.75 KB 109.46 KB RN_OSS_DEV
ReactFabric-prod.js -0.1% -0.0% 200.78 KB 200.67 KB 34.8 KB 34.79 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js -0.1% -0.1% 215.7 KB 215.53 KB 37.71 KB 37.68 KB RN_OSS_PROFILING
ReactFabric-profiling.js -0.1% -0.1% 207.56 KB 207.39 KB 36.23 KB 36.21 KB RN_OSS_PROFILING
ReactNativeRenderer-profiling.js -0.2% -0.1% 223.92 KB 223.51 KB 39.17 KB 39.13 KB RN_FB_PROFILING
ReactFabric-profiling.js -0.1% -0.1% 207.52 KB 207.35 KB 36.21 KB 36.19 KB RN_FB_PROFILING

scheduler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
scheduler.development.js n/a n/a 0 B 19.17 KB 0 B 5.74 KB UMD_DEV
scheduler.production.min.js n/a n/a 0 B 3.16 KB 0 B 1.53 KB UMD_PROD

Generated by 🚫 dangerJS

@@ -766,7 +761,7 @@ function commitRoot(root: FiberRoot, finishedWork: Fiber): void {
unhandledError = error;
}
} finally {
if (!nextRenderIncludesTimedOutPlaceholder) {
if (true) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

oops

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok whatever, ANdrew

Previously, we were emptying root.pendingInteractionMap and permanently losing those interactions when applying an unrelated update to a tree that has no scheduled work that is waiting on promise resolution. (That is, one that is showing a fallback and waiting for the suspended content to resolve.)

The logic I'm leaving untouched with `nextRenderIncludesTimedOutPlaceholder` is *not* correct -- what we want is instead to know if *any* placeholder anywhere in the tree is showing its fallback -- but we don't currently have a better replacement, and this should unblock tracing with suspense again.
Copy link
Collaborator

@acdlite acdlite left a comment

Choose a reason for hiding this comment

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

I think this makes sense. A little nervous since this heuristic has changed several times now, but tests give me confidence. Let's sync it and see what happens :D

Will follow-up on the bug you found about multiple pings to a timed-out placeholder.

@sophiebits sophiebits merged commit d836010 into facebook:master Oct 4, 2018
acdlite pushed a commit to plievone/react that referenced this pull request Oct 5, 2018
Previously, we were emptying root.pendingInteractionMap and permanently losing those interactions when applying an unrelated update to a tree that has no scheduled work that is waiting on promise resolution. (That is, one that is showing a fallback and waiting for the suspended content to resolve.)

The logic I'm leaving untouched with `nextRenderIncludesTimedOutPlaceholder` is *not* correct -- what we want is instead to know if *any* placeholder anywhere in the tree is showing its fallback -- but we don't currently have a better replacement, and this should unblock tracing with suspense again.
linjiajian999 pushed a commit to linjiajian999/react that referenced this pull request Oct 22, 2018
Previously, we were emptying root.pendingInteractionMap and permanently losing those interactions when applying an unrelated update to a tree that has no scheduled work that is waiting on promise resolution. (That is, one that is showing a fallback and waiting for the suspended content to resolve.)

The logic I'm leaving untouched with `nextRenderIncludesTimedOutPlaceholder` is *not* correct -- what we want is instead to know if *any* placeholder anywhere in the tree is showing its fallback -- but we don't currently have a better replacement, and this should unblock tracing with suspense again.
jetoneza pushed a commit to jetoneza/react that referenced this pull request Jan 23, 2019
Previously, we were emptying root.pendingInteractionMap and permanently losing those interactions when applying an unrelated update to a tree that has no scheduled work that is waiting on promise resolution. (That is, one that is showing a fallback and waiting for the suspended content to resolve.)

The logic I'm leaving untouched with `nextRenderIncludesTimedOutPlaceholder` is *not* correct -- what we want is instead to know if *any* placeholder anywhere in the tree is showing its fallback -- but we don't currently have a better replacement, and this should unblock tracing with suspense again.
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