Skip to content

Commit 6a5a80f

Browse files
committed
fix: Revert Measure the Rectangle of Suspense boundaries as we reconcile
1 parent fa50caf commit 6a5a80f

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
@@ -3486,7 +3486,6 @@ export function attach(
34863486
previouslyReconciledSiblingSuspenseNode = suspenseNode;
34873487
// While React didn't rerender this node, it's possible that it was affected by
34883488
// layout due to mutation of a parent or sibling. Check if it changed size.
3489-
measureUnchangedSuspenseNodesRecursively(suspenseNode);
34903489
// Continue
34913490
suspenseNode = nextRemainingSibling;
34923491
} else if (foundOne) {
@@ -4027,38 +4026,6 @@ export function attach(
40274026
newInstance = recordMount(fiber, reconcilingParent);
40284027
if (fiber.tag === SuspenseComponent || fiber.tag === HostRoot) {
40294028
newSuspenseNode = createSuspenseNode(newInstance);
4030-
// Measure this Suspense node. In general we shouldn't do this until we have
4031-
// inserted the new children but since we know this is a FiberInstance we'll
4032-
// just use the Fiber anyway.
4033-
// Fallbacks get attributed to the parent so we only measure if we're
4034-
// showing primary content.
4035-
if (fiber.tag === SuspenseComponent) {
4036-
if (OffscreenComponent === -1) {
4037-
const isTimedOut = fiber.memoizedState !== null;
4038-
if (!isTimedOut) {
4039-
newSuspenseNode.rects = measureInstance(newInstance);
4040-
}
4041-
} else {
4042-
const hydrated = isFiberHydrated(fiber);
4043-
if (hydrated) {
4044-
const contentFiber = fiber.child;
4045-
if (contentFiber === null) {
4046-
throw new Error(
4047-
'There should always be an Offscreen Fiber child in a hydrated Suspense boundary.',
4048-
);
4049-
}
4050-
} else {
4051-
// This Suspense Fiber is still dehydrated. It won't have any children
4052-
// until hydration.
4053-
}
4054-
const isTimedOut = fiber.memoizedState !== null;
4055-
if (!isTimedOut) {
4056-
newSuspenseNode.rects = measureInstance(newInstance);
4057-
}
4058-
}
4059-
} else {
4060-
newSuspenseNode.rects = measureInstance(newInstance);
4061-
}
40624029
recordSuspenseMount(newSuspenseNode, reconcilingParentSuspenseNode);
40634030
}
40644031
insertChild(newInstance);
@@ -4096,30 +4063,6 @@ export function attach(
40964063
// just use the Fiber anyway.
40974064
// Fallbacks get attributed to the parent so we only measure if we're
40984065
// showing primary content.
4099-
if (OffscreenComponent === -1) {
4100-
const isTimedOut = fiber.memoizedState !== null;
4101-
if (!isTimedOut) {
4102-
newSuspenseNode.rects = measureInstance(newInstance);
4103-
}
4104-
} else {
4105-
const hydrated = isFiberHydrated(fiber);
4106-
if (hydrated) {
4107-
const contentFiber = fiber.child;
4108-
if (contentFiber === null) {
4109-
throw new Error(
4110-
'There should always be an Offscreen Fiber child in a hydrated Suspense boundary.',
4111-
);
4112-
}
4113-
} else {
4114-
// This Suspense Fiber is still dehydrated. It won't have any children
4115-
// until hydration.
4116-
}
4117-
const suspenseState = fiber.memoizedState;
4118-
const isTimedOut = suspenseState !== null;
4119-
if (!isTimedOut) {
4120-
newSuspenseNode.rects = measureInstance(newInstance);
4121-
}
4122-
}
41234066
}
41244067
insertChild(newInstance);
41254068
if (__DEBUG__) {
@@ -5498,25 +5441,6 @@ export function attach(
54985441
reconcilingParent = stashedParent;
54995442
previouslyReconciledSibling = stashedPrevious;
55005443
remainingReconcilingChildren = stashedRemaining;
5501-
if (shouldMeasureSuspenseNode) {
5502-
if (!isInDisconnectedSubtree) {
5503-
// Measure this Suspense node in case it changed. We don't update the rect
5504-
// while we're inside a disconnected subtree so that we keep the outline
5505-
// as it was before we hid the parent.
5506-
const suspenseNode = fiberInstance.suspenseNode;
5507-
if (suspenseNode === null) {
5508-
throw new Error(
5509-
'Attempted to measure a Suspense node that does not exist.',
5510-
);
5511-
}
5512-
const prevRects = suspenseNode.rects;
5513-
const nextRects = measureInstance(fiberInstance);
5514-
if (!areEqualRects(prevRects, nextRects)) {
5515-
suspenseNode.rects = nextRects;
5516-
recordSuspenseResize(suspenseNode);
5517-
}
5518-
}
5519-
}
55205444
if (shouldPopSuspenseNode) {
55215445
reconcilingParentSuspenseNode = stashedSuspenseParent;
55225446
previouslyReconciledSiblingSuspenseNode = stashedSuspensePrevious;

0 commit comments

Comments
 (0)