Skip to content

Commit 8c15edd

Browse files
authored
[DevTools] Send root unmount as a regular removal operation (facebook#35107)
1 parent 5e94655 commit 8c15edd

File tree

1 file changed

+3
-24
lines changed
  • packages/react-devtools-shared/src/backend/fiber

1 file changed

+3
-24
lines changed

packages/react-devtools-shared/src/backend/fiber/renderer.js

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2159,7 +2159,6 @@ export function attach(
21592159
let pendingOperationsQueue: Array<OperationsArray> | null = [];
21602160
const pendingStringTable: Map<string, StringTableEntry> = new Map();
21612161
let pendingStringTableLength: number = 0;
2162-
let pendingUnmountedRootID: FiberInstance['id'] | null = null;
21632162
21642163
function pushOperation(op: number): void {
21652164
if (__DEV__) {
@@ -2187,8 +2186,7 @@ export function attach(
21872186
pendingOperations.length === 0 &&
21882187
pendingRealUnmountedIDs.length === 0 &&
21892188
pendingRealUnmountedSuspenseIDs.length === 0 &&
2190-
pendingSuspenderChanges.size === 0 &&
2191-
pendingUnmountedRootID === null
2189+
pendingSuspenderChanges.size === 0
21922190
);
21932191
}
21942192
@@ -2250,9 +2248,7 @@ export function attach(
22502248
return;
22512249
}
22522250
2253-
const numUnmountIDs =
2254-
pendingRealUnmountedIDs.length +
2255-
(pendingUnmountedRootID === null ? 0 : 1);
2251+
const numUnmountIDs = pendingRealUnmountedIDs.length;
22562252
const numUnmountSuspenseIDs = pendingRealUnmountedSuspenseIDs.length;
22572253
const numSuspenderChanges = pendingSuspenderChanges.size;
22582254
@@ -2330,11 +2326,6 @@ export function attach(
23302326
for (let j = 0; j < pendingRealUnmountedIDs.length; j++) {
23312327
operations[i++] = pendingRealUnmountedIDs[j];
23322328
}
2333-
// The root ID should always be unmounted last.
2334-
if (pendingUnmountedRootID !== null) {
2335-
operations[i] = pendingUnmountedRootID;
2336-
i++;
2337-
}
23382329
}
23392330
23402331
// Fill in pending operations.
@@ -2382,7 +2373,6 @@ export function attach(
23822373
pendingRealUnmountedIDs.length = 0;
23832374
pendingRealUnmountedSuspenseIDs.length = 0;
23842375
pendingSuspenderChanges.clear();
2385-
pendingUnmountedRootID = null;
23862376
pendingStringTable.clear();
23872377
pendingStringTableLength = 0;
23882378
}
@@ -2868,7 +2858,6 @@ export function attach(
28682858
// Already disconnected.
28692859
return;
28702860
}
2871-
const fiber = fiberInstance.data;
28722861
28732862
if (trackedPathMatchInstance === fiberInstance) {
28742863
// We're in the process of trying to restore previous selection.
@@ -2878,17 +2867,7 @@ export function attach(
28782867
}
28792868
28802869
const id = fiberInstance.id;
2881-
const isRoot = fiber.tag === HostRoot;
2882-
if (isRoot) {
2883-
// Roots must be removed only after all children have been removed.
2884-
// So we track it separately.
2885-
pendingUnmountedRootID = id;
2886-
} else {
2887-
// To maintain child-first ordering,
2888-
// we'll push it into one of these queues,
2889-
// and later arrange them in the correct order.
2890-
pendingRealUnmountedIDs.push(id);
2891-
}
2870+
pendingRealUnmountedIDs.push(id);
28922871
}
28932872
28942873
function recordSuspenseResize(suspenseNode: SuspenseNode): void {

0 commit comments

Comments
 (0)