Skip to content

Commit

Permalink
Fix enableClientRenderFallbackOnTextMismatch flag (#26457)
Browse files Browse the repository at this point in the history
With this flag off, we don't throw and therefore don't patch up the tree
when suppression is off.

Haven't tested.

---------

Co-authored-by: Rick Hanlon <rickhanlonii@fb.com>

DiffTrain build for [afb3d51](afb3d51)
  • Loading branch information
rickhanlonii committed Mar 22, 2023
1 parent 520ad06 commit 64facb3
Show file tree
Hide file tree
Showing 15 changed files with 334 additions and 466 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b93b4f07454298e99012201a5ecdd195a41baa50
afb3d51dc6310f0dbeffdd303eb3c6895e6f7db0
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-www-modern-36a2211a";
var ReactVersion = "18.3.0-www-modern-b3a4de20";

// ATTENTION
// When adding new symbols to this file,
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
return self;
}

var ReactVersion = "18.3.0-www-classic-20a03402";
var ReactVersion = "18.3.0-www-classic-ac5037f5";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactART-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -9627,7 +9627,7 @@ var slice = Array.prototype.slice,
return null;
},
bundleType: 0,
version: "18.3.0-www-modern-7b2876d5",
version: "18.3.0-www-modern-22ca78ee",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1312 = {
Expand Down Expand Up @@ -9658,7 +9658,7 @@ var internals$jscomp$inline_1312 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-7b2876d5"
reconcilerVersion: "18.3.0-www-modern-22ca78ee"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1313 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
8 changes: 4 additions & 4 deletions compiled/facebook-www/ReactDOM-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -6948,7 +6948,7 @@ function diffHydratedProperties(
);
}

if (!isConcurrentMode) {
if (!isConcurrentMode || !enableClientRenderFallbackOnTextMismatch) {
updatePayload = ["children", children];
}
}
Expand Down Expand Up @@ -14134,7 +14134,7 @@ function prepareToHydrateHostTextInstance(fiber) {
shouldWarnIfMismatchDev
);

if (isConcurrentMode) {
if (isConcurrentMode && enableClientRenderFallbackOnTextMismatch) {
// In concurrent mode we never update the mismatched text,
// even if the error was ignored.
return false;
Expand Down Expand Up @@ -14162,7 +14162,7 @@ function prepareToHydrateHostTextInstance(fiber) {
shouldWarnIfMismatchDev
);

if (_isConcurrentMode2) {
if (_isConcurrentMode2 && enableClientRenderFallbackOnTextMismatch) {
// In concurrent mode we never update the mismatched text,
// even if the error was ignored.
return false;
Expand Down Expand Up @@ -39144,7 +39144,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-classic-01e3cef5";
var ReactVersion = "18.3.0-www-classic-51af468f";

function createPortal$1(
children,
Expand Down
8 changes: 4 additions & 4 deletions compiled/facebook-www/ReactDOM-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -8591,7 +8591,7 @@ function prepareToHydrateHostTextInstance(fiber) {
shouldWarnIfMismatchDev
);

if (isConcurrentMode) {
if (isConcurrentMode && enableClientRenderFallbackOnTextMismatch) {
// In concurrent mode we never update the mismatched text,
// even if the error was ignored.
return false;
Expand Down Expand Up @@ -8619,7 +8619,7 @@ function prepareToHydrateHostTextInstance(fiber) {
shouldWarnIfMismatchDev
);

if (_isConcurrentMode2) {
if (_isConcurrentMode2 && enableClientRenderFallbackOnTextMismatch) {
// In concurrent mode we never update the mismatched text,
// even if the error was ignored.
return false;
Expand Down Expand Up @@ -33507,7 +33507,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-modern-7b2876d5";
var ReactVersion = "18.3.0-www-modern-22ca78ee";

function createPortal$1(
children,
Expand Down Expand Up @@ -40247,7 +40247,7 @@ function diffHydratedProperties(
);
}

if (!isConcurrentMode) {
if (!isConcurrentMode || !enableClientRenderFallbackOnTextMismatch) {
updatePayload = ["children", children];
}
}
Expand Down
126 changes: 52 additions & 74 deletions compiled/facebook-www/ReactDOM-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -3146,7 +3146,6 @@ function prepareToHydrateHostInstance(fiber) {
props = fiber.memoizedProps;
instance[internalInstanceKey] = fiber;
instance[internalPropsKey] = props;
var isConcurrentMode = 0 !== (fiber.mode & 1);
switch (type) {
case "dialog":
listenToNonDelegatedEvent("cancel", instance);
Expand Down Expand Up @@ -3188,19 +3187,15 @@ function prepareToHydrateHostInstance(fiber) {
}
props.hasOwnProperty("onScroll") &&
listenToNonDelegatedEvent("scroll", instance);
i = null;
var children = props.children;
if (
("string" === typeof children || "number" === typeof children) &&
instance.textContent !== "" + children
) {
if (!0 !== props.suppressHydrationWarning) {
var serverText = instance.textContent;
normalizeMarkupForTextOrAttribute(children);
normalizeMarkupForTextOrAttribute(serverText);
}
isConcurrentMode || (i = ["children", children]);
}
var updatePayload = null;
i = props.children;
("string" !== typeof i && "number" !== typeof i) ||
instance.textContent === "" + i ||
(!0 !== props.suppressHydrationWarning &&
((updatePayload = instance.textContent),
normalizeMarkupForTextOrAttribute(i),
normalizeMarkupForTextOrAttribute(updatePayload)),
(updatePayload = ["children", i]));
switch (type) {
case "input":
track(instance);
Expand All @@ -3216,7 +3211,7 @@ function prepareToHydrateHostInstance(fiber) {
default:
"function" === typeof props.onClick && (instance.onclick = noop$1);
}
instance = i;
instance = updatePayload;
fiber.updateQueue = instance;
return null !== instance ? !0 : !1;
}
Expand Down Expand Up @@ -8109,43 +8104,25 @@ function completeWork(current, workInProgress, renderLanes) {
throw Error(formatProdErrorMessage(166));
current = rootInstanceStackCursor.current;
if (popHydrationState(workInProgress)) {
a: {
newProps = workInProgress.stateNode;
current = workInProgress.memoizedProps;
newProps[internalInstanceKey] = workInProgress;
if ((renderLanes = newProps.nodeValue !== current)) {
var returnFiber = hydrationParentFiber;
if (null !== returnFiber)
switch (returnFiber.tag) {
case 3:
type = 0 !== (returnFiber.mode & 1);
newProps = newProps.nodeValue;
normalizeMarkupForTextOrAttribute(current);
normalizeMarkupForTextOrAttribute(newProps);
if (type) {
current = !1;
break a;
}
break;
case 27:
case 5:
if (
((type = 0 !== (returnFiber.mode & 1)),
!0 !==
returnFiber.memoizedProps.suppressHydrationWarning &&
((newProps = newProps.nodeValue),
normalizeMarkupForTextOrAttribute(current),
normalizeMarkupForTextOrAttribute(newProps)),
type)
) {
current = !1;
break a;
}
}
}
current = renderLanes;
}
current && markUpdate(workInProgress);
newProps = workInProgress.stateNode;
current = workInProgress.memoizedProps;
newProps[internalInstanceKey] = workInProgress;
if ((renderLanes = newProps.nodeValue !== current))
if (((type = hydrationParentFiber), null !== type))
switch (type.tag) {
case 3:
newProps = newProps.nodeValue;
normalizeMarkupForTextOrAttribute(current);
normalizeMarkupForTextOrAttribute(newProps);
break;
case 27:
case 5:
!0 !== type.memoizedProps.suppressHydrationWarning &&
((newProps = newProps.nodeValue),
normalizeMarkupForTextOrAttribute(current),
normalizeMarkupForTextOrAttribute(newProps));
}
renderLanes && markUpdate(workInProgress);
} else
(current =
getOwnerDocumentFromRootContainer(current).createTextNode(
Expand Down Expand Up @@ -8201,18 +8178,19 @@ function completeWork(current, workInProgress, renderLanes) {
return (workInProgress.lanes = renderLanes), workInProgress;
renderLanes = null !== newProps;
current = null !== current && null !== current.memoizedState;
renderLanes &&
((newProps = workInProgress.child),
(type = null),
if (renderLanes) {
newProps = workInProgress.child;
type = null;
null !== newProps.alternate &&
null !== newProps.alternate.memoizedState &&
null !== newProps.alternate.memoizedState.cachePool &&
(type = newProps.alternate.memoizedState.cachePool.pool),
(returnFiber = null),
(type = newProps.alternate.memoizedState.cachePool.pool);
var cache$142 = null;
null !== newProps.memoizedState &&
null !== newProps.memoizedState.cachePool &&
(returnFiber = newProps.memoizedState.cachePool.pool),
returnFiber !== type && (newProps.flags |= 2048));
(cache$142 = newProps.memoizedState.cachePool.pool);
cache$142 !== type && (newProps.flags |= 2048);
}
renderLanes !== current &&
(enableTransitionTracing && (workInProgress.child.flags |= 2048),
renderLanes && (workInProgress.child.flags |= 8192));
Expand Down Expand Up @@ -8247,20 +8225,20 @@ function completeWork(current, workInProgress, renderLanes) {
type = workInProgress.memoizedState;
if (null === type) return bubbleProperties(workInProgress), null;
newProps = 0 !== (workInProgress.flags & 128);
returnFiber = type.rendering;
if (null === returnFiber)
cache$142 = type.rendering;
if (null === cache$142)
if (newProps) cutOffTailIfNeeded(type, !1);
else {
if (
0 !== workInProgressRootExitStatus ||
(null !== current && 0 !== (current.flags & 128))
)
for (current = workInProgress.child; null !== current; ) {
returnFiber = findFirstSuspended(current);
if (null !== returnFiber) {
cache$142 = findFirstSuspended(current);
if (null !== cache$142) {
workInProgress.flags |= 128;
cutOffTailIfNeeded(type, !1);
current = returnFiber.updateQueue;
current = cache$142.updateQueue;
workInProgress.updateQueue = current;
scheduleRetryEffect(workInProgress, current);
workInProgress.subtreeFlags = 0;
Expand All @@ -8285,7 +8263,7 @@ function completeWork(current, workInProgress, renderLanes) {
}
else {
if (!newProps)
if (((current = findFirstSuspended(returnFiber)), null !== current)) {
if (((current = findFirstSuspended(cache$142)), null !== current)) {
if (
((workInProgress.flags |= 128),
(newProps = !0),
Expand All @@ -8295,7 +8273,7 @@ function completeWork(current, workInProgress, renderLanes) {
cutOffTailIfNeeded(type, !0),
null === type.tail &&
"hidden" === type.tailMode &&
!returnFiber.alternate &&
!cache$142.alternate &&
!isHydrating)
)
return bubbleProperties(workInProgress), null;
Expand All @@ -8308,13 +8286,13 @@ function completeWork(current, workInProgress, renderLanes) {
cutOffTailIfNeeded(type, !1),
(workInProgress.lanes = 8388608));
type.isBackwards
? ((returnFiber.sibling = workInProgress.child),
(workInProgress.child = returnFiber))
? ((cache$142.sibling = workInProgress.child),
(workInProgress.child = cache$142))
: ((current = type.last),
null !== current
? (current.sibling = returnFiber)
: (workInProgress.child = returnFiber),
(type.last = returnFiber));
? (current.sibling = cache$142)
: (workInProgress.child = cache$142),
(type.last = cache$142));
}
if (null !== type.tail)
return (
Expand Down Expand Up @@ -15830,7 +15808,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1775 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-classic-0ef6286c",
version: "18.3.0-www-classic-1f5575cc",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2155 = {
Expand Down Expand Up @@ -15860,7 +15838,7 @@ var internals$jscomp$inline_2155 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-classic-0ef6286c"
reconcilerVersion: "18.3.0-www-classic-1f5575cc"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2156 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -16100,4 +16078,4 @@ exports.unstable_renderSubtreeIntoContainer = function (
);
};
exports.unstable_runWithPriority = runWithPriority;
exports.version = "18.3.0-www-classic-0ef6286c";
exports.version = "18.3.0-www-classic-1f5575cc";
Loading

0 comments on commit 64facb3

Please sign in to comment.