GeezerVison is showing github.com — Track subtreeFlags et al with bubbleProperties · react/react@b66ae09
File treeExpand file treeCollapse file tree Open diff view settings packages/react-reconciler/src
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiber.new.js +4-1Lines changed: 4 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -28,7 +28,7 @@ import { | 28 | 28 | enableFundamentalAPI, | 29 | 29 | enableScopeAPI, | 30 | 30 | } from 'shared/ReactFeatureFlags'; | 31 | | -import {NoFlags, Placement} from './ReactFiberFlags'; | | 31 | +import {NoFlags, Placement, StaticMask} from './ReactFiberFlags'; | 32 | 32 | import {ConcurrentRoot, BlockingRoot} from './ReactRootTags'; | 33 | 33 | import { | 34 | 34 | IndeterminateComponent, | @@ -299,6 +299,9 @@ export function createWorkInProgress(current: Fiber, pendingProps: any): Fiber { | 299 | 299 | } | 300 | 300 | } | 301 | 301 |
| | 302 | + // Reset all effects except static ones. | | 303 | + // Static effects are not specific to a render. | | 304 | + workInProgress.flags = current.flags & StaticMask; | 302 | 305 | workInProgress.childLanes = current.childLanes; | 303 | 306 | workInProgress.lanes = current.lanes; | 304 | 307 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiber.old.js +4-1Lines changed: 4 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -28,7 +28,7 @@ import { | 28 | 28 | enableFundamentalAPI, | 29 | 29 | enableScopeAPI, | 30 | 30 | } from 'shared/ReactFeatureFlags'; | 31 | | -import {NoFlags, Placement} from './ReactFiberFlags'; | | 31 | +import {NoFlags, Placement, StaticMask} from './ReactFiberFlags'; | 32 | 32 | import {ConcurrentRoot, BlockingRoot} from './ReactRootTags'; | 33 | 33 | import { | 34 | 34 | IndeterminateComponent, | @@ -299,6 +299,9 @@ export function createWorkInProgress(current: Fiber, pendingProps: any): Fiber { | 299 | 299 | } | 300 | 300 | } | 301 | 301 |
| | 302 | + // Reset all effects except static ones. | | 303 | + // Static effects are not specific to a render. | | 304 | + workInProgress.flags = current.flags & StaticMask; | 302 | 305 | workInProgress.childLanes = current.childLanes; | 303 | 306 | workInProgress.lanes = current.lanes; | 304 | 307 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberBeginWork.new.js +7Lines changed: 7 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -63,6 +63,7 @@ import { | 63 | 63 | Deletion, | 64 | 64 | ChildDeletion, | 65 | 65 | ForceUpdateForLegacySuspense, | | 66 | + StaticMask, | 66 | 67 | } from './ReactFiberFlags'; | 67 | 68 | import ReactSharedInternals from 'shared/ReactSharedInternals'; | 68 | 69 | import { | @@ -2092,6 +2093,12 @@ function updateSuspenseFallbackChildren( | 2092 | 2093 | currentPrimaryChildFragment, | 2093 | 2094 | primaryChildProps, | 2094 | 2095 | ); | | 2096 | + | | 2097 | + // Since we're reusing a current tree, we need to reuse the flags, too. | | 2098 | + // (We don't do this in legacy mode, because in legacy mode we don't re-use | | 2099 | + // the current tree; see previous branch.) | | 2100 | + primaryChildFragment.subtreeFlags = | | 2101 | + currentPrimaryChildFragment.subtreeFlags & StaticMask; | 2095 | 2102 | } | 2096 | 2103 | let fallbackChildFragment; | 2097 | 2104 | if (currentFallbackChildFragment !== null) { | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberBeginWork.old.js +7Lines changed: 7 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -63,6 +63,7 @@ import { | 63 | 63 | Deletion, | 64 | 64 | ChildDeletion, | 65 | 65 | ForceUpdateForLegacySuspense, | | 66 | + StaticMask, | 66 | 67 | } from './ReactFiberFlags'; | 67 | 68 | import ReactSharedInternals from 'shared/ReactSharedInternals'; | 68 | 69 | import { | @@ -2092,6 +2093,12 @@ function updateSuspenseFallbackChildren( | 2092 | 2093 | currentPrimaryChildFragment, | 2093 | 2094 | primaryChildProps, | 2094 | 2095 | ); | | 2096 | + | | 2097 | + // Since we're reusing a current tree, we need to reuse the flags, too. | | 2098 | + // (We don't do this in legacy mode, because in legacy mode we don't re-use | | 2099 | + // the current tree; see previous branch.) | | 2100 | + primaryChildFragment.subtreeFlags = | | 2101 | + currentPrimaryChildFragment.subtreeFlags & StaticMask; | 2095 | 2102 | } | 2096 | 2103 | let fallbackChildFragment; | 2097 | 2104 | if (currentFallbackChildFragment !== null) { | |
|