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

Don't bailout after Suspending in Legacy Mode #19216

Merged
merged 3 commits into from Jun 30, 2020
Merged

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Jun 30, 2020

Fixes #17356.
Fixes #18844.

Has regression tests + verified sandboxes work.

Builds on the test case in #18572 and approach from #18572 (comment).

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 30, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 77ec289:

Sandbox Source
flamboyant-lalande-l7ci4 Configuration
React Suspense Maybe Bug Issue #17356
react-suspense-context-bug Issue #18844

@sizebot
Copy link

sizebot commented Jun 30, 2020

Details of bundled changes.

Comparing: 47ff31a...77ec289

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js +0.1% +0.1% 923.78 KB 924.54 KB 210.01 KB 210.26 KB NODE_DEV
ReactDOMForked-prod.js 0.0% 0.0% 395.65 KB 395.83 KB 73.42 KB 73.44 KB FB_WWW_PROD
react-dom-server.node.development.js 0.0% -0.0% 138.65 KB 138.65 KB 36.67 KB 36.67 KB NODE_DEV
react-dom.production.min.js 🔺+0.1% 🔺+0.1% 126.78 KB 126.87 KB 40.34 KB 40.36 KB NODE_PROD
ReactDOMForked-profiling.js 0.0% 0.0% 406.19 KB 406.37 KB 75.18 KB 75.21 KB FB_WWW_PROFILING
react-dom-server.browser.development.js 0.0% -0.0% 144.83 KB 144.83 KB 36.87 KB 36.87 KB UMD_DEV
react-dom-server.node.production.min.js 0.0% 0.0% 20.68 KB 20.68 KB 7.66 KB 7.66 KB NODE_PROD
ReactDOMTesting-dev.js +0.1% +0.1% 953.75 KB 954.54 KB 214.36 KB 214.62 KB FB_WWW_DEV
react-dom-test-utils.development.js 0.0% 0.0% 70.09 KB 70.1 KB 19.6 KB 19.6 KB NODE_DEV
ReactDOMTesting-prod.js 0.0% 0.0% 394.95 KB 395.13 KB 74.53 KB 74.55 KB FB_WWW_PROD
react-dom-test-utils.production.min.js 0.0% 0.0% 13.06 KB 13.06 KB 4.8 KB 4.81 KB NODE_PROD
react-dom-unstable-fizz.browser.development.js 0.0% -0.1% 5.36 KB 5.36 KB 1.81 KB 1.8 KB UMD_DEV
react-dom-unstable-fizz.node.production.min.js 0.0% 🔺+0.2% 1.17 KB 1.17 KB 666 B 667 B NODE_PROD
ReactTestUtils-dev.js 0.0% 0.0% 51.27 KB 51.28 KB 14.38 KB 14.38 KB FB_WWW_DEV
react-dom-unstable-fizz.browser.development.js 0.0% -0.1% 4.87 KB 4.87 KB 1.71 KB 1.7 KB NODE_DEV
react-dom.development.js +0.1% +0.1% 970.72 KB 971.5 KB 212.78 KB 213.03 KB UMD_DEV
react-dom.production.min.js 🔺+0.1% 🔺+0.1% 126.56 KB 126.65 KB 41.22 KB 41.26 KB UMD_PROD
react-dom.profiling.min.js +0.1% +0.1% 130.53 KB 130.62 KB 42.39 KB 42.43 KB UMD_PROFILING
ReactDOMForked-dev.js +0.1% +0.1% 973.36 KB 974.15 KB 217.34 KB 217.58 KB FB_WWW_DEV
react-dom.profiling.min.js +0.1% +0.1% 130.91 KB 131 KB 41.52 KB 41.54 KB NODE_PROFILING
ReactDOM-dev.js +0.1% +0.1% 980.47 KB 981.25 KB 218.63 KB 218.88 KB FB_WWW_DEV
ReactDOM-prod.js 0.0% 0.0% 395.85 KB 396.03 KB 73.43 KB 73.45 KB FB_WWW_PROD
ReactDOM-profiling.js 0.0% 0.0% 406.38 KB 406.56 KB 75.19 KB 75.22 KB FB_WWW_PROFILING
react-dom-test-utils.development.js 0.0% 0.0% 75.26 KB 75.28 KB 20.1 KB 20.1 KB UMD_DEV

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-dev.js +0.1% +0.2% 683.37 KB 684.16 KB 147.71 KB 148 KB RN_FB_DEV
ReactFabric-dev.js +0.1% +0.2% 664.09 KB 664.88 KB 143.09 KB 143.34 KB RN_FB_DEV
ReactNativeRenderer-dev.js +0.1% +0.2% 678.5 KB 679.28 KB 146.94 KB 147.24 KB RN_OSS_DEV
ReactFabric-prod.js 🔺+0.1% 0.0% 265.64 KB 265.82 KB 46.98 KB 47.01 KB RN_FB_PROD
ReactNativeRenderer-prod.js 🔺+0.1% 0.0% 271.97 KB 272.15 KB 48.27 KB 48.29 KB RN_OSS_PROD
ReactFabric-profiling.js +0.1% 0.0% 277.18 KB 277.36 KB 49.2 KB 49.23 KB RN_FB_PROFILING
ReactNativeRenderer-profiling.js +0.1% +0.1% 283.47 KB 283.65 KB 50.46 KB 50.49 KB RN_OSS_PROFILING
ReactNativeRenderer-prod.js 🔺+0.1% 0.0% 271.92 KB 272.1 KB 48.25 KB 48.27 KB RN_FB_PROD
ReactNativeRenderer-profiling.js +0.1% +0.1% 283.42 KB 283.6 KB 50.44 KB 50.47 KB RN_FB_PROFILING
ReactFabric-dev.js +0.1% +0.2% 659.21 KB 659.99 KB 142.32 KB 142.57 KB RN_OSS_DEV
ReactFabric-prod.js 🔺+0.1% 0.0% 265.68 KB 265.86 KB 47 KB 47.02 KB RN_OSS_PROD
ReactFabric-profiling.js +0.1% 0.0% 277.22 KB 277.4 KB 49.22 KB 49.24 KB RN_OSS_PROFILING

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactART-prod.js 🔺+0.1% 0.0% 240.28 KB 240.46 KB 42.46 KB 42.48 KB FB_WWW_PROD
react-art.development.js +0.1% +0.2% 686.59 KB 687.37 KB 145.41 KB 145.66 KB UMD_DEV
react-art.production.min.js 🔺+0.1% 🔺+0.1% 112.36 KB 112.45 KB 34.76 KB 34.8 KB UMD_PROD
react-art.development.js +0.1% +0.2% 588.15 KB 588.91 KB 127.56 KB 127.8 KB NODE_DEV
react-art.production.min.js 🔺+0.1% 🔺+0.1% 77.32 KB 77.41 KB 23.9 KB 23.92 KB NODE_PROD
ReactART-dev.js +0.1% +0.2% 617.13 KB 617.92 KB 131.41 KB 131.67 KB FB_WWW_DEV

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js +0.1% +0.2% 602.98 KB 603.77 KB 126.64 KB 126.91 KB UMD_DEV
react-test-renderer.production.min.js 🔺+0.1% 🔺+0.1% 76.61 KB 76.7 KB 23.97 KB 24 KB UMD_PROD
react-test-renderer.development.js +0.1% +0.2% 574.48 KB 575.24 KB 125.17 KB 125.42 KB NODE_DEV
react-test-renderer.production.min.js 🔺+0.1% 🔺+0.1% 76.44 KB 76.53 KB 23.67 KB 23.69 KB NODE_PROD
ReactTestRenderer-dev.js +0.1% +0.2% 597.78 KB 598.56 KB 128.06 KB 128.33 KB FB_WWW_DEV
ReactTestRenderer-dev.js +0.1% +0.2% 590.84 KB 591.63 KB 127.78 KB 128.07 KB RN_FB_DEV
react-test-renderer-shallow.development.js 0.0% -0.0% 39.17 KB 39.17 KB 9.58 KB 9.58 KB UMD_DEV

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler.development.js +0.1% +0.2% 645.97 KB 646.73 KB 137.68 KB 137.92 KB NODE_DEV
react-reconciler-reflection.development.js +0.1% 0.0% 16.7 KB 16.71 KB 4.98 KB 4.98 KB NODE_DEV
react-reconciler.production.min.js 🔺+0.1% 🔺+0.1% 87.11 KB 87.2 KB 26.63 KB 26.66 KB NODE_PROD
react-reconciler-reflection.production.min.js 0.0% -0.1% 2.81 KB 2.81 KB 1.16 KB 1.16 KB NODE_PROD

Size changes (experimental)

Generated by 🚫 dangerJS against 77ec289

@sizebot
Copy link

sizebot commented Jun 30, 2020

Details of bundled changes.

Comparing: 47ff31a...77ec289

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js +0.1% +0.1% 893.35 KB 894.11 KB 204.44 KB 204.7 KB NODE_DEV
ReactDOMForked-prod.js 0.0% 0.0% 406.84 KB 407.02 KB 75.25 KB 75.28 KB FB_WWW_PROD
react-dom.production.min.js 🔺+0.1% 🔺+0.1% 122.31 KB 122.4 KB 39.04 KB 39.06 KB NODE_PROD
ReactDOMForked-profiling.js 0.0% 0.0% 417.43 KB 417.61 KB 77.03 KB 77.06 KB FB_WWW_PROFILING
react-dom-test-utils.production.min.js 0.0% -0.0% 13.17 KB 13.17 KB 4.89 KB 4.89 KB UMD_PROD
ReactDOMTesting-dev.js +0.1% +0.1% 979.55 KB 980.33 KB 220.02 KB 220.28 KB FB_WWW_DEV
react-dom-test-utils.development.js 0.0% 0.0% 70.08 KB 70.09 KB 19.59 KB 19.59 KB NODE_DEV
ReactDOMTesting-prod.js 0.0% 0.0% 406.92 KB 407.1 KB 76.48 KB 76.51 KB FB_WWW_PROD
react-dom-test-utils.production.min.js 0.0% 0.0% 13.05 KB 13.05 KB 4.8 KB 4.8 KB NODE_PROD
ReactTestUtils-dev.js 0.0% 0.0% 51.27 KB 51.28 KB 14.37 KB 14.37 KB FB_WWW_DEV
react-dom.development.js +0.1% +0.1% 938.93 KB 939.72 KB 207.09 KB 207.38 KB UMD_DEV
react-dom.production.min.js 🔺+0.1% 🔺+0.1% 122.17 KB 122.26 KB 39.92 KB 39.95 KB UMD_PROD
react-dom.profiling.min.js +0.1% +0.1% 126.08 KB 126.17 KB 41.09 KB 41.11 KB UMD_PROFILING
ReactDOMForked-dev.js +0.1% +0.1% 998.91 KB 999.69 KB 223.15 KB 223.39 KB FB_WWW_DEV
react-dom.profiling.min.js +0.1% +0.1% 126.39 KB 126.48 KB 40.25 KB 40.29 KB NODE_PROFILING
ReactDOM-dev.js +0.1% +0.1% 1006.01 KB 1006.8 KB 224.43 KB 224.68 KB FB_WWW_DEV
ReactDOM-prod.js 0.0% 0.0% 407.03 KB 407.21 KB 75.27 KB 75.29 KB FB_WWW_PROD
ReactDOM-profiling.js 0.0% 0.0% 417.63 KB 417.81 KB 77.04 KB 77.07 KB FB_WWW_PROFILING
ReactDOMServer-dev.js 0.0% -0.0% 146.97 KB 146.97 KB 37.38 KB 37.38 KB FB_WWW_DEV
react-dom-test-utils.development.js 0.0% 0.0% 75.25 KB 75.26 KB 20.09 KB 20.1 KB UMD_DEV

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactART-prod.js 🔺+0.1% 0.0% 247.42 KB 247.6 KB 43.74 KB 43.76 KB FB_WWW_PROD
react-art.development.js +0.1% +0.2% 664.43 KB 665.21 KB 141.33 KB 141.6 KB UMD_DEV
react-art.production.min.js 🔺+0.1% 🔺+0.1% 109.41 KB 109.5 KB 33.86 KB 33.89 KB UMD_PROD
react-art.development.js +0.1% +0.2% 566.9 KB 567.66 KB 123.53 KB 123.78 KB NODE_DEV
react-art.production.min.js 🔺+0.1% 🔺+0.1% 74.43 KB 74.52 KB 23.02 KB 23.05 KB NODE_PROD
ReactART-dev.js +0.1% +0.2% 627.15 KB 627.93 KB 133.45 KB 133.7 KB FB_WWW_DEV

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js +0.1% +0.2% 602.95 KB 603.74 KB 126.63 KB 126.9 KB UMD_DEV
react-test-renderer.production.min.js 🔺+0.1% 🔺+0.1% 76.59 KB 76.68 KB 23.96 KB 23.98 KB UMD_PROD
react-test-renderer.development.js +0.1% +0.2% 574.46 KB 575.21 KB 125.16 KB 125.41 KB NODE_DEV
react-test-renderer.production.min.js 🔺+0.1% 🔺+0.1% 76.41 KB 76.5 KB 23.65 KB 23.67 KB NODE_PROD
ReactTestRenderer-dev.js +0.1% +0.2% 597.76 KB 598.55 KB 128.05 KB 128.32 KB FB_WWW_DEV
ReactTestRenderer-dev.js +0.1% +0.2% 590.83 KB 591.62 KB 127.77 KB 128.06 KB RN_FB_DEV
react-test-renderer-shallow.development.js 0.0% -0.0% 39.16 KB 39.16 KB 9.57 KB 9.57 KB UMD_DEV

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-dev.js +0.1% +0.2% 678.48 KB 679.27 KB 146.94 KB 147.23 KB RN_OSS_DEV
ReactNativeRenderer-prod.js 🔺+0.1% 0.0% 271.95 KB 272.13 KB 48.26 KB 48.28 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js +0.1% +0.1% 283.46 KB 283.64 KB 50.45 KB 50.48 KB RN_OSS_PROFILING
ReactFabric-dev.js +0.1% +0.2% 659.19 KB 659.98 KB 142.31 KB 142.57 KB RN_OSS_DEV
ReactFabric-prod.js 🔺+0.1% 0.0% 265.67 KB 265.85 KB 46.99 KB 47.01 KB RN_OSS_PROD
ReactFabric-profiling.js +0.1% 0.0% 277.2 KB 277.38 KB 49.21 KB 49.24 KB RN_OSS_PROFILING

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler.development.js +0.1% +0.2% 622.36 KB 623.12 KB 133.17 KB 133.42 KB NODE_DEV
react-reconciler-reflection.development.js +0.1% 0.0% 16.68 KB 16.69 KB 4.98 KB 4.98 KB NODE_DEV
react-reconciler.production.min.js 🔺+0.1% 🔺+0.1% 83.78 KB 83.87 KB 25.74 KB 25.76 KB NODE_PROD
react-reconciler-reflection.production.min.js 0.0% -0.1% 2.8 KB 2.8 KB 1.15 KB 1.15 KB NODE_PROD

ReactDOM: size: 0.0%, gzip: -0.0%

Size changes (stable)

Generated by 🚫 dangerJS against 77ec289

@gaearon
Copy link
Collaborator Author

gaearon commented Jun 30, 2020

Seems like I'll need a broader fix with the effect tag so that it works for other Fiber types too.

@gaearon gaearon changed the title Don't bailout Memo in Legacy mode after Suspending Don't bailout after Suspending in Legacy Mode Jun 30, 2020
@gaearon gaearon force-pushed the susp branch 3 times, most recently from 438537d to ea251a6 Compare June 30, 2020 14:12
@gaearon
Copy link
Collaborator Author

gaearon commented Jun 30, 2020

Upd.

// consumer produces a changed value, it will set this to true. Otherwise,
// the component will assume the children have not changed and bail out.
didReceiveUpdate = false;
if ((current.effectTag & ForceUpdateForLegacySuspense) !== NoEffect) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wouldn't expect this check to be necessary, since whenever you hit this block, you'll always fall into the updateSimpleMemoComponent path, so you can do everything in there.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

@gaearon gaearon Jun 30, 2020

Choose a reason for hiding this comment

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

This isn't specific to SimpleMemo though. This block is to fix the issue for all other cases (e.g. normal memo, or a function component). See the rest of the tests.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah. God Legacy Mode is annoying. OK that makes sense then.

@gaearon
Copy link
Collaborator Author

gaearon commented Jun 30, 2020

Upd2. I think the generic check is still needed because this is a fix for more than SimpleMemo path. #18844 was about functions in general, with the referential equality bailout as the problem.

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.

OK I'm cool with this

@gaearon gaearon merged commit 8bff898 into facebook:master Jun 30, 2020
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
5 participants