-
Notifications
You must be signed in to change notification settings - Fork 49.8k
Add eager alternate.stateNode cleanup #33161
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
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,6 +59,7 @@ import { | |
| enableComponentPerformanceTrack, | ||
| enableViewTransition, | ||
| enableFragmentRefs, | ||
| enableEagerAlternateStateNodeCleanup, | ||
| } from 'shared/ReactFeatureFlags'; | ||
| import { | ||
| FunctionComponent, | ||
|
|
@@ -2170,6 +2171,18 @@ function commitMutationEffectsOnFiber( | |
| } | ||
| } | ||
| } | ||
| } else { | ||
| if (enableEagerAlternateStateNodeCleanup) { | ||
| if (supportsPersistence && finishedWork.alternate !== null) { | ||
| // `finishedWork.alternate.stateNode` is pointing to a stale shadow | ||
| // node at this point, retaining it and its subtree. To reclaim | ||
| // memory, point `alternate.stateNode` to new shadow node. This | ||
| // prevents shadow node from staying in memory longer than it | ||
| // needs to. The correct behaviour of this is checked by test in | ||
| // React Native: ShadowNodeReferenceCounter-itest.js#L150 | ||
| finishedWork.alternate.stateNode = finishedWork.stateNode; | ||
|
||
| } | ||
| } | ||
| } | ||
| break; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -141,6 +141,8 @@ export const enablePersistedModeClonedFlag = false; | |
|
|
||
| export const enableShallowPropDiffing = false; | ||
|
|
||
| export const enableEagerAlternateStateNodeCleanup = false; | ||
|
||
|
|
||
| /** | ||
| * Enables an expiration time for retry lanes to avoid starvation. | ||
| */ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.