Skip to content

Commit 794dc9c

Browse files
committed
fix: Revert Measure the Rectangle of Suspense boundaries as we reconcile
1 parent eb2f784 commit 794dc9c

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
@@ -3406,7 +3406,6 @@ export function attach(
34063406
previouslyReconciledSiblingSuspenseNode = suspenseNode;
34073407
// While React didn't rerender this node, it's possible that it was affected by
34083408
// layout due to mutation of a parent or sibling. Check if it changed size.
3409-
measureUnchangedSuspenseNodesRecursively(suspenseNode);
34103409
// Continue
34113410
suspenseNode = nextRemainingSibling;
34123411
} else if (foundOne) {
@@ -3947,38 +3946,6 @@ export function attach(
39473946
newInstance = recordMount(fiber, reconcilingParent);
39483947
if (fiber.tag === SuspenseComponent || fiber.tag === HostRoot) {
39493948
newSuspenseNode = createSuspenseNode(newInstance);
3950-
// Measure this Suspense node. In general we shouldn't do this until we have
3951-
// inserted the new children but since we know this is a FiberInstance we'll
3952-
// just use the Fiber anyway.
3953-
// Fallbacks get attributed to the parent so we only measure if we're
3954-
// showing primary content.
3955-
if (fiber.tag === SuspenseComponent) {
3956-
if (OffscreenComponent === -1) {
3957-
const isTimedOut = fiber.memoizedState !== null;
3958-
if (!isTimedOut) {
3959-
newSuspenseNode.rects = measureInstance(newInstance);
3960-
}
3961-
} else {
3962-
const hydrated = isFiberHydrated(fiber);
3963-
if (hydrated) {
3964-
const contentFiber = fiber.child;
3965-
if (contentFiber === null) {
3966-
throw new Error(
3967-
'There should always be an Offscreen Fiber child in a hydrated Suspense boundary.',
3968-
);
3969-
}
3970-
} else {
3971-
// This Suspense Fiber is still dehydrated. It won't have any children
3972-
// until hydration.
3973-
}
3974-
const isTimedOut = fiber.memoizedState !== null;
3975-
if (!isTimedOut) {
3976-
newSuspenseNode.rects = measureInstance(newInstance);
3977-
}
3978-
}
3979-
} else {
3980-
newSuspenseNode.rects = measureInstance(newInstance);
3981-
}
39823949
recordSuspenseMount(newSuspenseNode, reconcilingParentSuspenseNode);
39833950
}
39843951
insertChild(newInstance);
@@ -4016,30 +3983,6 @@ export function attach(
40163983
// just use the Fiber anyway.
40173984
// Fallbacks get attributed to the parent so we only measure if we're
40183985
// showing primary content.
4019-
if (OffscreenComponent === -1) {
4020-
const isTimedOut = fiber.memoizedState !== null;
4021-
if (!isTimedOut) {
4022-
newSuspenseNode.rects = measureInstance(newInstance);
4023-
}
4024-
} else {
4025-
const hydrated = isFiberHydrated(fiber);
4026-
if (hydrated) {
4027-
const contentFiber = fiber.child;
4028-
if (contentFiber === null) {
4029-
throw new Error(
4030-
'There should always be an Offscreen Fiber child in a hydrated Suspense boundary.',
4031-
);
4032-
}
4033-
} else {
4034-
// This Suspense Fiber is still dehydrated. It won't have any children
4035-
// until hydration.
4036-
}
4037-
const suspenseState = fiber.memoizedState;
4038-
const isTimedOut = suspenseState !== null;
4039-
if (!isTimedOut) {
4040-
newSuspenseNode.rects = measureInstance(newInstance);
4041-
}
4042-
}
40433986
}
40443987
insertChild(newInstance);
40453988
if (__DEBUG__) {
@@ -5418,25 +5361,6 @@ export function attach(
54185361
reconcilingParent = stashedParent;
54195362
previouslyReconciledSibling = stashedPrevious;
54205363
remainingReconcilingChildren = stashedRemaining;
5421-
if (shouldMeasureSuspenseNode) {
5422-
if (!isInDisconnectedSubtree) {
5423-
// Measure this Suspense node in case it changed. We don't update the rect
5424-
// while we're inside a disconnected subtree so that we keep the outline
5425-
// as it was before we hid the parent.
5426-
const suspenseNode = fiberInstance.suspenseNode;
5427-
if (suspenseNode === null) {
5428-
throw new Error(
5429-
'Attempted to measure a Suspense node that does not exist.',
5430-
);
5431-
}
5432-
const prevRects = suspenseNode.rects;
5433-
const nextRects = measureInstance(fiberInstance);
5434-
if (!areEqualRects(prevRects, nextRects)) {
5435-
suspenseNode.rects = nextRects;
5436-
recordSuspenseResize(suspenseNode);
5437-
}
5438-
}
5439-
}
54405364
if (shouldPopSuspenseNode) {
54415365
reconcilingParentSuspenseNode = stashedSuspenseParent;
54425366
previouslyReconciledSiblingSuspenseNode = stashedSuspensePrevious;

0 commit comments

Comments
 (0)