Skip to content

Commit b42180d

Browse files
committed
Call cleanup of insertion effects when hidden (#30954)
Insertion effects do not unmount when a subtree is removed while offscreen. Current behavior for an insertion effect is if the component goes - *visible -> removed:* calls insertion effect cleanup - *visible -> offscreen -> removed:* insertion effect cleanup is never called This makes it so we always call insertion effect cleanup when removing the component. Likely also fixes #26670 --------- Co-authored-by: Rick Hanlon <rickhanlonii@fb.com> DiffTrain build for commit d3d4d3a.
1 parent 03205d9 commit b42180d

14 files changed

+575
-335
lines changed

compiled-rn/VERSION_NATIVE_FB

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19.0.0-native-fb-94e4acaa-20240913
1+
19.0.0-native-fb-d3d4d3a4-20240913

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-dev.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<7a44af74badbc39b3911200f0c8f1ea4>>
10+
* @generated SignedSource<<2d89a3e686f85aa5ee5696aad303b4b0>>
1111
*/
1212

1313
"use strict";
1414
__DEV__ &&
1515
(function () {
16-
function JSCompiler_object_inline_createNodeMock_1105() {
16+
function JSCompiler_object_inline_createNodeMock_1109() {
1717
return null;
1818
}
1919
function findHook(fiber, id) {
@@ -9384,12 +9384,11 @@ __DEV__ &&
93849384
case 11:
93859385
case 14:
93869386
case 15:
9387+
_prevHostParent = deletedFiber.updateQueue;
93879388
if (
9388-
!offscreenSubtreeWasHidden &&
9389-
((_prevHostParent = deletedFiber.updateQueue),
93909389
null !== _prevHostParent &&
9391-
((_prevHostParent = _prevHostParent.lastEffect),
9392-
null !== _prevHostParent))
9390+
((_prevHostParent = _prevHostParent.lastEffect),
9391+
null !== _prevHostParent)
93939392
) {
93949393
_prevHostParentIsContainer = _prevHostParent = _prevHostParent.next;
93959394
do {
@@ -9398,15 +9397,18 @@ __DEV__ &&
93989397
destroy = inst.destroy;
93999398
void 0 !== destroy &&
94009399
((tag & Insertion) !== NoFlags
9401-
? ((inst.destroy = void 0),
9400+
? ((isRunningInsertionEffect = !0),
9401+
(inst.destroy = void 0),
94029402
runWithFiberInDEV(
94039403
deletedFiber,
94049404
callDestroyInDEV,
94059405
deletedFiber,
94069406
nearestMountedAncestor,
94079407
destroy
9408-
))
9409-
: (tag & Layout) !== NoFlags &&
9408+
),
9409+
(isRunningInsertionEffect = !1))
9410+
: offscreenSubtreeWasHidden ||
9411+
(tag & Layout) === NoFlags ||
94109412
(markComponentLayoutEffectUnmountStarted(deletedFiber),
94119413
shouldProfile(deletedFiber)
94129414
? (startLayoutEffectTimer(),
@@ -15122,11 +15124,11 @@ __DEV__ &&
1512215124
(function () {
1512315125
var internals = {
1512415126
bundleType: 1,
15125-
version: "19.0.0-native-fb-94e4acaa-20240913",
15127+
version: "19.0.0-native-fb-d3d4d3a4-20240913",
1512615128
rendererPackageName: "react-test-renderer",
1512715129
currentDispatcherRef: ReactSharedInternals,
1512815130
findFiberByHostInstance: getInstanceFromNode,
15129-
reconcilerVersion: "19.0.0-native-fb-94e4acaa-20240913"
15131+
reconcilerVersion: "19.0.0-native-fb-d3d4d3a4-20240913"
1513015132
};
1513115133
internals.overrideHookState = overrideHookState;
1513215134
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -15148,7 +15150,7 @@ __DEV__ &&
1514815150
exports._Scheduler = Scheduler;
1514915151
exports.act = act;
1515015152
exports.create = function (element, options) {
15151-
var createNodeMock = JSCompiler_object_inline_createNodeMock_1105,
15153+
var createNodeMock = JSCompiler_object_inline_createNodeMock_1109,
1515215154
isConcurrent = !1,
1515315155
isStrictMode = !1;
1515415156
"object" === typeof options &&
@@ -15271,5 +15273,5 @@ __DEV__ &&
1527115273
flushSyncWorkAcrossRoots_impl(0, !0));
1527215274
}
1527315275
};
15274-
exports.version = "19.0.0-native-fb-94e4acaa-20240913";
15276+
exports.version = "19.0.0-native-fb-d3d4d3a4-20240913";
1527515277
})();

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-prod.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<79c30664ec056acbff09d56e15b605d0>>
10+
* @generated SignedSource<<4f55ec78358c8ebecf4eaa369cc81849>>
1111
*/
1212

1313
"use strict";
@@ -6635,11 +6635,8 @@ function commitDeletionEffectsOnFiber(
66356635
case 11:
66366636
case 14:
66376637
case 15:
6638-
if (
6639-
!offscreenSubtreeWasHidden &&
6640-
((index = deletedFiber.updateQueue),
6641-
null !== index && ((index = index.lastEffect), null !== index))
6642-
) {
6638+
index = deletedFiber.updateQueue;
6639+
if (null !== index && ((index = index.lastEffect), null !== index)) {
66436640
index$jscomp$0 = index = index.next;
66446641
do {
66456642
prevHostParent = index$jscomp$0.tag;
@@ -6653,7 +6650,8 @@ function commitDeletionEffectsOnFiber(
66536650
nearestMountedAncestor,
66546651
destroy
66556652
))
6656-
: 0 !== (prevHostParent & 4) &&
6653+
: offscreenSubtreeWasHidden ||
6654+
0 === (prevHostParent & 4) ||
66576655
((prevHostParentIsContainer.destroy = void 0),
66586656
safelyCallDestroy(
66596657
deletedFiber,
@@ -9488,14 +9486,14 @@ function wrapFiber(fiber) {
94889486
}
94899487
var internals$jscomp$inline_1266 = {
94909488
bundleType: 0,
9491-
version: "19.0.0-native-fb-94e4acaa-20240913",
9489+
version: "19.0.0-native-fb-d3d4d3a4-20240913",
94929490
rendererPackageName: "react-test-renderer",
94939491
currentDispatcherRef: ReactSharedInternals,
94949492
findFiberByHostInstance: function (mockNode) {
94959493
mockNode = nodeToInstanceMap.get(mockNode);
94969494
return void 0 !== mockNode ? mockNode.internalInstanceHandle : null;
94979495
},
9498-
reconcilerVersion: "19.0.0-native-fb-94e4acaa-20240913"
9496+
reconcilerVersion: "19.0.0-native-fb-d3d4d3a4-20240913"
94999497
};
95009498
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
95019499
var hook$jscomp$inline_1267 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -9631,4 +9629,4 @@ exports.unstable_batchedUpdates = function (fn, a) {
96319629
flushSyncWorkAcrossRoots_impl(0, !0));
96329630
}
96339631
};
9634-
exports.version = "19.0.0-native-fb-94e4acaa-20240913";
9632+
exports.version = "19.0.0-native-fb-d3d4d3a4-20240913";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-profiling.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<1b967cee52d371092874f9ae20a82460>>
10+
* @generated SignedSource<<b264040d9a17e92d86c094ff1ead550e>>
1111
*/
1212

1313
"use strict";
@@ -7049,11 +7049,8 @@ function commitDeletionEffectsOnFiber(
70497049
case 11:
70507050
case 14:
70517051
case 15:
7052-
if (
7053-
!offscreenSubtreeWasHidden &&
7054-
((index = deletedFiber.updateQueue),
7055-
null !== index && ((index = index.lastEffect), null !== index))
7056-
) {
7052+
index = deletedFiber.updateQueue;
7053+
if (null !== index && ((index = index.lastEffect), null !== index)) {
70577054
index$jscomp$0 = index = index.next;
70587055
do {
70597056
prevHostParent = index$jscomp$0.tag;
@@ -7067,7 +7064,8 @@ function commitDeletionEffectsOnFiber(
70677064
nearestMountedAncestor,
70687065
destroy
70697066
))
7070-
: 0 !== (prevHostParent & 4) &&
7067+
: offscreenSubtreeWasHidden ||
7068+
0 === (prevHostParent & 4) ||
70717069
(markComponentLayoutEffectUnmountStarted(deletedFiber),
70727070
shouldProfile(deletedFiber)
70737071
? (startLayoutEffectTimer(),
@@ -10076,14 +10074,14 @@ function wrapFiber(fiber) {
1007610074
}
1007710075
var internals$jscomp$inline_1141 = {
1007810076
bundleType: 0,
10079-
version: "19.0.0-native-fb-94e4acaa-20240913",
10077+
version: "19.0.0-native-fb-d3d4d3a4-20240913",
1008010078
rendererPackageName: "react-test-renderer",
1008110079
currentDispatcherRef: ReactSharedInternals,
1008210080
findFiberByHostInstance: function (mockNode) {
1008310081
mockNode = nodeToInstanceMap.get(mockNode);
1008410082
return void 0 !== mockNode ? mockNode.internalInstanceHandle : null;
1008510083
},
10086-
reconcilerVersion: "19.0.0-native-fb-94e4acaa-20240913",
10084+
reconcilerVersion: "19.0.0-native-fb-d3d4d3a4-20240913",
1008710085
getLaneLabelMap: function () {
1008810086
for (
1008910087
var map = new Map(), lane = 1, index$138 = 0;
@@ -10234,4 +10232,4 @@ exports.unstable_batchedUpdates = function (fn, a) {
1023410232
flushSyncWorkAcrossRoots_impl(0, !0));
1023510233
}
1023610234
};
10237-
exports.version = "19.0.0-native-fb-94e4acaa-20240913";
10235+
exports.version = "19.0.0-native-fb-d3d4d3a4-20240913";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-dev.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<311f6e22a22d12061756c8044a0696a3>>
10+
* @generated SignedSource<<598e1a1554be705744125c5f6e86546f>>
1111
*/
1212

1313
"use strict";
@@ -1705,7 +1705,7 @@ __DEV__ &&
17051705
exports.useTransition = function () {
17061706
return resolveDispatcher().useTransition();
17071707
};
1708-
exports.version = "19.0.0-native-fb-94e4acaa-20240913";
1708+
exports.version = "19.0.0-native-fb-d3d4d3a4-20240913";
17091709
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
17101710
"function" ===
17111711
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-prod.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<22d627e46625db555a755a27eabe5462>>
10+
* @generated SignedSource<<b8568e853b095ed822fa12f152e3121e>>
1111
*/
1212

1313
"use strict";
@@ -580,4 +580,4 @@ exports.useSyncExternalStore = function (
580580
exports.useTransition = function () {
581581
return ReactSharedInternals.H.useTransition();
582582
};
583-
exports.version = "19.0.0-native-fb-94e4acaa-20240913";
583+
exports.version = "19.0.0-native-fb-d3d4d3a4-20240913";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react/cjs/React-profiling.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<587bcb4d44e630fb36fd55546d100d27>>
10+
* @generated SignedSource<<92d8fbd56fb11e8c6a3aad4c04d6df3c>>
1111
*/
1212

1313
"use strict";
@@ -584,7 +584,7 @@ exports.useSyncExternalStore = function (
584584
exports.useTransition = function () {
585585
return ReactSharedInternals.H.useTransition();
586586
};
587-
exports.version = "19.0.0-native-fb-94e4acaa-20240913";
587+
exports.version = "19.0.0-native-fb-d3d4d3a4-20240913";
588588
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
589589
"function" ===
590590
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
94e4acaa1477e65cac02ba86058cde0afe4c8f1f
1+
d3d4d3a46b014ab0f6edc443c19fcdba09105f20

0 commit comments

Comments
 (0)