Skip to content

Commit a4855c3

Browse files
committed
fix forks
1 parent 5c3a456 commit a4855c3

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

packages/react-reconciler/src/ReactFiberHydrationContext.new.js

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -413,15 +413,12 @@ function tryToClaimNextHydratableInstance(fiber: Fiber): void {
413413
fiber.tag === HostComponent &&
414414
isHydratableResource(fiber.type, fiber.pendingProps)
415415
) {
416-
const resourceInstance = getMatchingResourceInstance(
416+
fiber.stateNode = getMatchingResourceInstance(
417417
fiber.type,
418418
fiber.pendingProps,
419419
getRootHostContainer(),
420420
);
421-
if (resourceInstance) {
422-
fiber.stateNode = resourceInstance;
423-
return;
424-
}
421+
return;
425422
}
426423
}
427424
let nextInstance = nextHydratableInstance;
@@ -616,8 +613,29 @@ function popHydrationState(fiber: Fiber): boolean {
616613
if (!supportsHydration) {
617614
return false;
618615
}
619-
if (enableFloat && isHydratableResource(fiber.type, fiber.memoizedProps)) {
620-
return !!fiber.stateNode;
616+
if (
617+
enableFloat &&
618+
isHydrating &&
619+
isHydratableResource(fiber.type, fiber.memoizedProps)
620+
) {
621+
if (fiber.stateNode === null) {
622+
if (__DEV__) {
623+
const rel = fiber.memoizedProps.rel
624+
? `rel="${fiber.memoizedProps.rel}" `
625+
: '';
626+
const href = fiber.memoizedProps.href
627+
? `href="${fiber.memoizedProps.href}"`
628+
: '';
629+
console.error(
630+
'A matching Hydratable Resource was not found in the DOM for <%s %s%s>.',
631+
fiber.type,
632+
rel,
633+
href,
634+
);
635+
}
636+
throwOnHydrationMismatch(fiber);
637+
}
638+
return true;
621639
}
622640
if (fiber !== hydrationParentFiber) {
623641
// We're deeper than the current hydration context, inside an inserted

0 commit comments

Comments
 (0)