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 clean up twice in hidden trees #24282

Closed
wants to merge 5 commits into from

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Apr 5, 2022

Based on #24281

Fixes #24280. This is pretty invasive and likely subtly (or not so subtly) wrong.
Putting it out there for discussion on the approach.

Without whitespace

The idea is to track the "outermost hidden" Offscreen node during the commit traversal. We need to know the outermost one because it's the one that determines whether we're actually hidden or not. We need the fiber and not just the boolean because we need to know when on our way up to reset the state.

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Apr 5, 2022
@@ -2153,8 +2228,9 @@ function commitMutationEffects_begin(root: FiberRoot, lanes: Lanes) {
if (deletions !== null) {
for (let i = 0; i < deletions.length; i++) {
const childToDelete = deletions[i];
const outermostHiddenFiber = findOutermostHiddenFiber(childToDelete);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This searches up to the root for each fiber in the deletion list. I don't know if there's a way to avoid this. We need to somehow know where we are in the tree before we start descending.

@@ -1980,7 +1980,6 @@ describe('ReactSuspenseEffectsSemantics', () => {

// Destroy layout and passive effects in the errored tree.
'App destroy layout',
'ThrowsInWillUnmount componentWillUnmount',
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this was a bug since it was already earlier in the list. So removing it seems correct to me.

@gaearon gaearon requested review from sebmarkbage and acdlite April 5, 2022 18:29
@sizebot
Copy link

sizebot commented Apr 5, 2022

Comparing: af73043...01e3269

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js +0.20% 131.40 kB 131.66 kB +0.14% 41.99 kB 42.05 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js +0.20% 136.45 kB 136.72 kB +0.21% 43.43 kB 43.52 kB
facebook-www/ReactDOM-prod.classic.js +0.42% 433.07 kB 434.87 kB +0.31% 79.60 kB 79.85 kB
facebook-www/ReactDOM-prod.modern.js +0.43% 418.07 kB 419.87 kB +0.31% 77.24 kB 77.48 kB
facebook-www/ReactDOMForked-prod.classic.js +0.42% 433.07 kB 434.87 kB +0.31% 79.61 kB 79.85 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
facebook-www/ReactART-prod.modern.js +0.67% 267.20 kB 269.00 kB +0.49% 47.60 kB 47.83 kB
facebook-react-native/react-test-renderer/cjs/ReactTestRenderer-prod.js +0.66% 247.59 kB 249.22 kB +0.51% 45.26 kB 45.49 kB
facebook-www/ReactART-prod.classic.js +0.65% 277.99 kB 279.78 kB +0.48% 49.39 kB 49.63 kB
facebook-react-native/react-test-renderer/cjs/ReactTestRenderer-profiling.js +0.62% 262.37 kB 264.00 kB +0.51% 47.60 kB 47.84 kB
react-native/implementations/ReactNativeRenderer-prod.js +0.58% 284.08 kB 285.73 kB +0.46% 51.31 kB 51.54 kB
react-native/implementations/ReactNativeRenderer-prod.fb.js +0.56% 292.21 kB 293.86 kB +0.45% 53.00 kB 53.24 kB
react-native/implementations/ReactNativeRenderer-profiling.js +0.54% 303.09 kB 304.74 kB +0.40% 54.49 kB 54.70 kB
react-native/implementations/ReactNativeRenderer-profiling.fb.js +0.52% 319.07 kB 320.72 kB +0.40% 57.17 kB 57.39 kB
facebook-www/ReactDOM-prod.modern.js +0.43% 418.07 kB 419.87 kB +0.31% 77.24 kB 77.48 kB
facebook-www/ReactDOMForked-prod.modern.js +0.43% 418.07 kB 419.87 kB +0.31% 77.24 kB 77.48 kB
react-native/implementations/ReactFabric-prod.js +0.42% 277.47 kB 278.65 kB +0.41% 50.12 kB 50.33 kB
facebook-www/ReactDOM-prod.classic.js +0.42% 433.07 kB 434.87 kB +0.31% 79.60 kB 79.85 kB
facebook-www/ReactDOMForked-prod.classic.js +0.42% 433.07 kB 434.87 kB +0.31% 79.61 kB 79.85 kB
react-native/implementations/ReactFabric-profiling.js +0.42% 296.44 kB 297.67 kB +0.33% 53.39 kB 53.56 kB
react-native/implementations/ReactFabric-prod.fb.js +0.41% 290.22 kB 291.40 kB +0.39% 52.55 kB 52.75 kB
facebook-www/ReactDOMTesting-prod.modern.js +0.41% 411.94 kB 413.61 kB +0.30% 77.43 kB 77.66 kB
facebook-www/ReactDOM-profiling.modern.js +0.40% 448.74 kB 450.54 kB +0.28% 81.79 kB 82.02 kB
facebook-www/ReactDOMForked-profiling.modern.js +0.40% 448.74 kB 450.54 kB +0.28% 81.80 kB 82.03 kB
react-native/implementations/ReactFabric-profiling.fb.js +0.39% 317.19 kB 318.42 kB +0.32% 56.83 kB 57.01 kB
facebook-www/ReactDOMTesting-prod.classic.js +0.39% 428.37 kB 430.04 kB +0.30% 80.17 kB 80.40 kB
facebook-www/ReactDOM-profiling.classic.js +0.39% 463.83 kB 465.64 kB +0.27% 84.21 kB 84.44 kB
facebook-www/ReactDOMForked-profiling.classic.js +0.39% 463.83 kB 465.64 kB +0.27% 84.22 kB 84.45 kB
oss-stable-semver/react-art/cjs/react-art.production.min.js +0.33% 81.88 kB 82.15 kB +0.46% 25.31 kB 25.42 kB
oss-stable/react-art/cjs/react-art.production.min.js +0.33% 81.88 kB 82.15 kB +0.46% 25.31 kB 25.42 kB
oss-stable-semver/react-test-renderer/umd/react-test-renderer.production.min.js +0.32% 84.20 kB 84.47 kB +0.34% 26.16 kB 26.25 kB
oss-stable/react-test-renderer/umd/react-test-renderer.production.min.js +0.32% 84.20 kB 84.47 kB +0.34% 26.16 kB 26.25 kB
oss-stable-semver/react-test-renderer/cjs/react-test-renderer.production.min.js +0.32% 84.00 kB 84.26 kB +0.34% 25.85 kB 25.94 kB
oss-stable/react-test-renderer/cjs/react-test-renderer.production.min.js +0.32% 84.00 kB 84.26 kB +0.34% 25.85 kB 25.94 kB
oss-experimental/react-art/cjs/react-art.production.min.js +0.31% 86.49 kB 86.75 kB +0.41% 26.69 kB 26.80 kB
oss-experimental/react-test-renderer/umd/react-test-renderer.production.min.js +0.31% 88.45 kB 88.72 kB +0.56% 27.37 kB 27.52 kB
oss-experimental/react-test-renderer/cjs/react-test-renderer.production.min.js +0.30% 88.25 kB 88.52 kB +0.14% 27.13 kB 27.17 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler.production.min.js +0.30% 92.69 kB 92.97 kB +0.21% 28.43 kB 28.49 kB
oss-stable/react-reconciler/cjs/react-reconciler.production.min.js +0.30% 92.69 kB 92.97 kB +0.21% 28.43 kB 28.49 kB
oss-experimental/react-reconciler/cjs/react-reconciler.production.min.js +0.27% 97.35 kB 97.61 kB +0.38% 29.68 kB 29.79 kB
facebook-www/ReactTestRenderer-dev.classic.js +0.26% 674.24 kB 676.02 kB +0.18% 145.39 kB 145.65 kB
facebook-www/ReactTestRenderer-dev.modern.js +0.26% 674.25 kB 676.03 kB +0.18% 145.39 kB 145.66 kB
facebook-react-native/react-test-renderer/cjs/ReactTestRenderer-dev.js +0.26% 652.82 kB 654.53 kB +0.14% 141.44 kB 141.63 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler.profiling.min.js +0.26% 101.59 kB 101.86 kB +0.16% 30.62 kB 30.67 kB
oss-stable/react-reconciler/cjs/react-reconciler.profiling.min.js +0.26% 101.59 kB 101.86 kB +0.16% 30.62 kB 30.67 kB
oss-experimental/react-reconciler/cjs/react-reconciler.profiling.min.js +0.25% 106.25 kB 106.51 kB +0.11% 31.98 kB 32.02 kB
facebook-www/ReactART-dev.modern.js +0.24% 753.32 kB 755.11 kB +0.13% 160.99 kB 161.21 kB
facebook-www/ReactART-dev.classic.js +0.23% 763.53 kB 765.32 kB +0.14% 163.13 kB 163.35 kB
oss-stable-semver/react-test-renderer/cjs/react-test-renderer.development.js +0.23% 615.85 kB 617.28 kB +0.10% 135.26 kB 135.40 kB
oss-stable/react-test-renderer/cjs/react-test-renderer.development.js +0.23% 615.85 kB 617.28 kB +0.10% 135.26 kB 135.40 kB
oss-stable-semver/react-test-renderer/umd/react-test-renderer.development.js +0.23% 645.56 kB 647.05 kB +0.11% 136.69 kB 136.83 kB
oss-stable/react-test-renderer/umd/react-test-renderer.development.js +0.23% 645.56 kB 647.05 kB +0.11% 136.69 kB 136.83 kB
react-native/implementations/ReactNativeRenderer-dev.js +0.23% 743.63 kB 745.35 kB +0.12% 163.24 kB 163.43 kB
oss-stable-semver/react-art/umd/react-art.production.min.js +0.23% 117.78 kB 118.05 kB +0.43% 36.51 kB 36.67 kB
oss-stable/react-art/umd/react-art.production.min.js +0.23% 117.78 kB 118.05 kB +0.43% 36.51 kB 36.67 kB
oss-experimental/react-test-renderer/cjs/react-test-renderer.development.js +0.22% 640.79 kB 642.23 kB +0.09% 140.30 kB 140.43 kB
oss-experimental/react-art/umd/react-art.production.min.js +0.22% 122.31 kB 122.59 kB +0.16% 37.88 kB 37.94 kB
oss-experimental/react-test-renderer/umd/react-test-renderer.development.js +0.22% 671.79 kB 673.29 kB +0.10% 141.70 kB 141.85 kB
react-native/implementations/ReactNativeRenderer-dev.fb.js +0.22% 786.11 kB 787.85 kB +0.10% 171.04 kB 171.22 kB
oss-stable-semver/react-art/cjs/react-art.development.js +0.22% 673.64 kB 675.09 kB +0.11% 145.88 kB 146.04 kB
oss-stable/react-art/cjs/react-art.development.js +0.22% 673.64 kB 675.09 kB +0.11% 145.88 kB 146.04 kB
oss-experimental/react-art/cjs/react-art.development.js +0.21% 700.26 kB 701.71 kB +0.10% 151.40 kB 151.56 kB
oss-stable-semver/react-dom/cjs/react-dom.production.min.js +0.20% 131.40 kB 131.66 kB +0.14% 41.99 kB 42.05 kB
oss-stable/react-dom/cjs/react-dom.production.min.js +0.20% 131.40 kB 131.66 kB +0.14% 41.99 kB 42.05 kB

Generated by 🚫 dangerJS against 01e3269

@gaearon
Copy link
Collaborator Author

gaearon commented Apr 11, 2022

Fixed in #24308 instead.

@gaearon gaearon closed this Apr 11, 2022
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
Development

Successfully merging this pull request may close these issues.

Bug: componentWillUnmount is called twice
3 participants