Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5d1ce65

Browse filesBrowse files
authored
Align StrictMode behaviour with production (#25049)
* Skip double invoking effects in Offscreen * Run yarn replace-fork * Use executionContext to disable profiler timer * Restructure recursion into two functions * Fix ReactStrictMode test * Use gate pragma in ReacetOffscreenStrictMode test * Set and reset current debug fiber in dev * Skip over paths that don't include any insertions * Extract common logic to check for profiling to a helper function * Remove hasPassiveEffects flag from StrictMode * Fix flow issues * Revert "Skip over paths that don't include any insertions"
1 parent 9e67e7a commit 5d1ce65
Copy full SHA for 5d1ce65

10 files changed

+376-557Lines changed: 376 additions & 557 deletions
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/react-reconciler/src/ReactChildFiber.new.js‎

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactChildFiber.new.js
+9-4Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ import type {Fiber} from './ReactInternalTypes';
1313
import type {Lanes} from './ReactFiberLane.new';
1414

1515
import getComponentNameFromFiber from 'react-reconciler/src/getComponentNameFromFiber';
16-
import {Placement, ChildDeletion, Forked} from './ReactFiberFlags';
16+
import {
17+
Placement,
18+
ChildDeletion,
19+
Forked,
20+
PlacementDEV,
21+
} from './ReactFiberFlags';
1722
import {
1823
getIteratorFn,
1924
REACT_ELEMENT_TYPE,
@@ -343,15 +348,15 @@ function ChildReconciler(shouldTrackSideEffects) {
343348
const oldIndex = current.index;
344349
if (oldIndex < lastPlacedIndex) {
345350
// This is a move.
346-
newFiber.flags |= Placement;
351+
newFiber.flags |= Placement | PlacementDEV;
347352
return lastPlacedIndex;
348353
} else {
349354
// This item can stay in place.
350355
return oldIndex;
351356
}
352357
} else {
353358
// This is an insertion.
354-
newFiber.flags |= Placement;
359+
newFiber.flags |= Placement | PlacementDEV;
355360
return lastPlacedIndex;
356361
}
357362
}
@@ -360,7 +365,7 @@ function ChildReconciler(shouldTrackSideEffects) {
360365
// This is simpler for the single child case. We only need to do a
361366
// placement for inserting new children.
362367
if (shouldTrackSideEffects && newFiber.alternate === null) {
363-
newFiber.flags |= Placement;
368+
newFiber.flags |= Placement | PlacementDEV;
364369
}
365370
return newFiber;
366371
}
Collapse file

‎packages/react-reconciler/src/ReactChildFiber.old.js‎

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactChildFiber.old.js
+9-4Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ import type {Fiber} from './ReactInternalTypes';
1313
import type {Lanes} from './ReactFiberLane.old';
1414

1515
import getComponentNameFromFiber from 'react-reconciler/src/getComponentNameFromFiber';
16-
import {Placement, ChildDeletion, Forked} from './ReactFiberFlags';
16+
import {
17+
Placement,
18+
ChildDeletion,
19+
Forked,
20+
PlacementDEV,
21+
} from './ReactFiberFlags';
1722
import {
1823
getIteratorFn,
1924
REACT_ELEMENT_TYPE,
@@ -343,15 +348,15 @@ function ChildReconciler(shouldTrackSideEffects) {
343348
const oldIndex = current.index;
344349
if (oldIndex < lastPlacedIndex) {
345350
// This is a move.
346-
newFiber.flags |= Placement;
351+
newFiber.flags |= Placement | PlacementDEV;
347352
return lastPlacedIndex;
348353
} else {
349354
// This item can stay in place.
350355
return oldIndex;
351356
}
352357
} else {
353358
// This is an insertion.
354-
newFiber.flags |= Placement;
359+
newFiber.flags |= Placement | PlacementDEV;
355360
return lastPlacedIndex;
356361
}
357362
}
@@ -360,7 +365,7 @@ function ChildReconciler(shouldTrackSideEffects) {
360365
// This is simpler for the single child case. We only need to do a
361366
// placement for inserting new children.
362367
if (shouldTrackSideEffects && newFiber.alternate === null) {
363-
newFiber.flags |= Placement;
368+
newFiber.flags |= Placement | PlacementDEV;
364369
}
365370
return newFiber;
366371
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.