Skip to content

Commit 55b7b59

Browse files
committed
fix: Revert Measure the Rectangle of Suspense boundaries as we reconcile
1 parent 55480b4 commit 55b7b59

File tree

1 file changed

+0
-76
lines changed
  • packages/react-devtools-shared/src/backend/fiber

1 file changed

+0
-76
lines changed

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

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -3549,7 +3549,6 @@ export function attach(
35493549
previouslyReconciledSiblingSuspenseNode = suspenseNode;
35503550
// While React didn't rerender this node, it's possible that it was affected by
35513551
// layout due to mutation of a parent or sibling. Check if it changed size.
3552-
measureUnchangedSuspenseNodesRecursively(suspenseNode);
35533552
// Continue
35543553
suspenseNode = nextRemainingSibling;
35553554
} else if (foundOne) {
@@ -4102,38 +4101,6 @@ export function attach(
41024101
}
41034102
if (fiber.tag === SuspenseComponent || fiber.tag === HostRoot) {
41044103
newSuspenseNode = createSuspenseNode(newInstance);
4105-
// Measure this Suspense node. In general we shouldn't do this until we have
4106-
// inserted the new children but since we know this is a FiberInstance we'll
4107-
// just use the Fiber anyway.
4108-
// Fallbacks get attributed to the parent so we only measure if we're
4109-
// showing primary content.
4110-
if (fiber.tag === SuspenseComponent) {
4111-
if (OffscreenComponent === -1) {
4112-
const isTimedOut = fiber.memoizedState !== null;
4113-
if (!isTimedOut) {
4114-
newSuspenseNode.rects = measureInstance(newInstance);
4115-
}
4116-
} else {
4117-
const hydrated = isFiberHydrated(fiber);
4118-
if (hydrated) {
4119-
const contentFiber = fiber.child;
4120-
if (contentFiber === null) {
4121-
throw new Error(
4122-
'There should always be an Offscreen Fiber child in a hydrated Suspense boundary.',
4123-
);
4124-
}
4125-
} else {
4126-
// This Suspense Fiber is still dehydrated. It won't have any children
4127-
// until hydration.
4128-
}
4129-
const isTimedOut = fiber.memoizedState !== null;
4130-
if (!isTimedOut) {
4131-
newSuspenseNode.rects = measureInstance(newInstance);
4132-
}
4133-
}
4134-
} else {
4135-
newSuspenseNode.rects = measureInstance(newInstance);
4136-
}
41374104
recordSuspenseMount(newSuspenseNode, reconcilingParentSuspenseNode);
41384105
}
41394106
insertChild(newInstance);
@@ -4171,30 +4138,6 @@ export function attach(
41714138
// just use the Fiber anyway.
41724139
// Fallbacks get attributed to the parent so we only measure if we're
41734140
// showing primary content.
4174-
if (OffscreenComponent === -1) {
4175-
const isTimedOut = fiber.memoizedState !== null;
4176-
if (!isTimedOut) {
4177-
newSuspenseNode.rects = measureInstance(newInstance);
4178-
}
4179-
} else {
4180-
const hydrated = isFiberHydrated(fiber);
4181-
if (hydrated) {
4182-
const contentFiber = fiber.child;
4183-
if (contentFiber === null) {
4184-
throw new Error(
4185-
'There should always be an Offscreen Fiber child in a hydrated Suspense boundary.',
4186-
);
4187-
}
4188-
} else {
4189-
// This Suspense Fiber is still dehydrated. It won't have any children
4190-
// until hydration.
4191-
}
4192-
const suspenseState = fiber.memoizedState;
4193-
const isTimedOut = suspenseState !== null;
4194-
if (!isTimedOut) {
4195-
newSuspenseNode.rects = measureInstance(newInstance);
4196-
}
4197-
}
41984141
}
41994142
insertChild(newInstance);
42004143
if (__DEBUG__) {
@@ -5614,25 +5557,6 @@ export function attach(
56145557
reconcilingParent = stashedParent;
56155558
previouslyReconciledSibling = stashedPrevious;
56165559
remainingReconcilingChildren = stashedRemaining;
5617-
if (shouldMeasureSuspenseNode) {
5618-
if (!isInDisconnectedSubtree) {
5619-
// Measure this Suspense node in case it changed. We don't update the rect
5620-
// while we're inside a disconnected subtree so that we keep the outline
5621-
// as it was before we hid the parent.
5622-
const suspenseNode = fiberInstance.suspenseNode;
5623-
if (suspenseNode === null) {
5624-
throw new Error(
5625-
'Attempted to measure a Suspense node that does not exist.',
5626-
);
5627-
}
5628-
const prevRects = suspenseNode.rects;
5629-
const nextRects = measureInstance(fiberInstance);
5630-
if (!areEqualRects(prevRects, nextRects)) {
5631-
suspenseNode.rects = nextRects;
5632-
recordSuspenseResize(suspenseNode);
5633-
}
5634-
}
5635-
}
56365560
if (shouldPopSuspenseNode) {
56375561
reconcilingParentSuspenseNode = stashedSuspenseParent;
56385562
previouslyReconciledSiblingSuspenseNode = stashedSuspensePrevious;

0 commit comments

Comments
 (0)