Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 3 additions & 24 deletions packages/react-devtools-shared/src/backend/fiber/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2159,7 +2159,6 @@ export function attach(
let pendingOperationsQueue: Array<OperationsArray> | null = [];
const pendingStringTable: Map<string, StringTableEntry> = new Map();
let pendingStringTableLength: number = 0;
let pendingUnmountedRootID: FiberInstance['id'] | null = null;

function pushOperation(op: number): void {
if (__DEV__) {
Expand Down Expand Up @@ -2187,8 +2186,7 @@ export function attach(
pendingOperations.length === 0 &&
pendingRealUnmountedIDs.length === 0 &&
pendingRealUnmountedSuspenseIDs.length === 0 &&
pendingSuspenderChanges.size === 0 &&
pendingUnmountedRootID === null
pendingSuspenderChanges.size === 0
);
}

Expand Down Expand Up @@ -2250,9 +2248,7 @@ export function attach(
return;
}

const numUnmountIDs =
pendingRealUnmountedIDs.length +
(pendingUnmountedRootID === null ? 0 : 1);
const numUnmountIDs = pendingRealUnmountedIDs.length;
const numUnmountSuspenseIDs = pendingRealUnmountedSuspenseIDs.length;
const numSuspenderChanges = pendingSuspenderChanges.size;

Expand Down Expand Up @@ -2330,11 +2326,6 @@ export function attach(
for (let j = 0; j < pendingRealUnmountedIDs.length; j++) {
operations[i++] = pendingRealUnmountedIDs[j];
}
// The root ID should always be unmounted last.
if (pendingUnmountedRootID !== null) {
operations[i] = pendingUnmountedRootID;
i++;
}
}

// Fill in pending operations.
Expand Down Expand Up @@ -2382,7 +2373,6 @@ export function attach(
pendingRealUnmountedIDs.length = 0;
pendingRealUnmountedSuspenseIDs.length = 0;
pendingSuspenderChanges.clear();
pendingUnmountedRootID = null;
pendingStringTable.clear();
pendingStringTableLength = 0;
}
Expand Down Expand Up @@ -2868,7 +2858,6 @@ export function attach(
// Already disconnected.
return;
}
const fiber = fiberInstance.data;

if (trackedPathMatchInstance === fiberInstance) {
// We're in the process of trying to restore previous selection.
Expand All @@ -2878,17 +2867,7 @@ export function attach(
}

const id = fiberInstance.id;
const isRoot = fiber.tag === HostRoot;
if (isRoot) {
// Roots must be removed only after all children have been removed.
// So we track it separately.
pendingUnmountedRootID = id;
} else {
// To maintain child-first ordering,
// we'll push it into one of these queues,
// and later arrange them in the correct order.
pendingRealUnmountedIDs.push(id);
}
pendingRealUnmountedIDs.push(id);
}

function recordSuspenseResize(suspenseNode: SuspenseNode): void {
Expand Down
Loading