Skip to content

Commit 64facb3

Browse files
committed
Fix enableClientRenderFallbackOnTextMismatch flag (#26457)
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)
1 parent 520ad06 commit 64facb3

15 files changed

+334
-466
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
b93b4f07454298e99012201a5ecdd195a41baa50
1+
afb3d51dc6310f0dbeffdd303eb3c6895e6f7db0

compiled/facebook-www/React-dev.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (
2727
}
2828
"use strict";
2929

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

3232
// ATTENTION
3333
// When adding new symbols to this file,

compiled/facebook-www/ReactART-dev.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
6969
return self;
7070
}
7171

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

7474
var LegacyRoot = 0;
7575
var ConcurrentRoot = 1;

compiled/facebook-www/ReactART-prod.modern.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9627,7 +9627,7 @@ var slice = Array.prototype.slice,
96279627
return null;
96289628
},
96299629
bundleType: 0,
9630-
version: "18.3.0-www-modern-7b2876d5",
9630+
version: "18.3.0-www-modern-22ca78ee",
96319631
rendererPackageName: "react-art"
96329632
};
96339633
var internals$jscomp$inline_1312 = {
@@ -9658,7 +9658,7 @@ var internals$jscomp$inline_1312 = {
96589658
scheduleRoot: null,
96599659
setRefreshHandler: null,
96609660
getCurrentFiber: null,
9661-
reconcilerVersion: "18.3.0-www-modern-7b2876d5"
9661+
reconcilerVersion: "18.3.0-www-modern-22ca78ee"
96629662
};
96639663
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
96649664
var hook$jscomp$inline_1313 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled/facebook-www/ReactDOM-dev.classic.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6948,7 +6948,7 @@ function diffHydratedProperties(
69486948
);
69496949
}
69506950

6951-
if (!isConcurrentMode) {
6951+
if (!isConcurrentMode || !enableClientRenderFallbackOnTextMismatch) {
69526952
updatePayload = ["children", children];
69536953
}
69546954
}
@@ -14134,7 +14134,7 @@ function prepareToHydrateHostTextInstance(fiber) {
1413414134
shouldWarnIfMismatchDev
1413514135
);
1413614136

14137-
if (isConcurrentMode) {
14137+
if (isConcurrentMode && enableClientRenderFallbackOnTextMismatch) {
1413814138
// In concurrent mode we never update the mismatched text,
1413914139
// even if the error was ignored.
1414014140
return false;
@@ -14162,7 +14162,7 @@ function prepareToHydrateHostTextInstance(fiber) {
1416214162
shouldWarnIfMismatchDev
1416314163
);
1416414164

14165-
if (_isConcurrentMode2) {
14165+
if (_isConcurrentMode2 && enableClientRenderFallbackOnTextMismatch) {
1416614166
// In concurrent mode we never update the mismatched text,
1416714167
// even if the error was ignored.
1416814168
return false;
@@ -39144,7 +39144,7 @@ function createFiberRoot(
3914439144
return root;
3914539145
}
3914639146

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

3914939149
function createPortal$1(
3915039150
children,

compiled/facebook-www/ReactDOM-dev.modern.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8591,7 +8591,7 @@ function prepareToHydrateHostTextInstance(fiber) {
85918591
shouldWarnIfMismatchDev
85928592
);
85938593

8594-
if (isConcurrentMode) {
8594+
if (isConcurrentMode && enableClientRenderFallbackOnTextMismatch) {
85958595
// In concurrent mode we never update the mismatched text,
85968596
// even if the error was ignored.
85978597
return false;
@@ -8619,7 +8619,7 @@ function prepareToHydrateHostTextInstance(fiber) {
86198619
shouldWarnIfMismatchDev
86208620
);
86218621

8622-
if (_isConcurrentMode2) {
8622+
if (_isConcurrentMode2 && enableClientRenderFallbackOnTextMismatch) {
86238623
// In concurrent mode we never update the mismatched text,
86248624
// even if the error was ignored.
86258625
return false;
@@ -33507,7 +33507,7 @@ function createFiberRoot(
3350733507
return root;
3350833508
}
3350933509

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

3351233512
function createPortal$1(
3351333513
children,
@@ -40247,7 +40247,7 @@ function diffHydratedProperties(
4024740247
);
4024840248
}
4024940249

40250-
if (!isConcurrentMode) {
40250+
if (!isConcurrentMode || !enableClientRenderFallbackOnTextMismatch) {
4025140251
updatePayload = ["children", children];
4025240252
}
4025340253
}

compiled/facebook-www/ReactDOM-prod.classic.js

Lines changed: 52 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -3146,7 +3146,6 @@ function prepareToHydrateHostInstance(fiber) {
31463146
props = fiber.memoizedProps;
31473147
instance[internalInstanceKey] = fiber;
31483148
instance[internalPropsKey] = props;
3149-
var isConcurrentMode = 0 !== (fiber.mode & 1);
31503149
switch (type) {
31513150
case "dialog":
31523151
listenToNonDelegatedEvent("cancel", instance);
@@ -3188,19 +3187,15 @@ function prepareToHydrateHostInstance(fiber) {
31883187
}
31893188
props.hasOwnProperty("onScroll") &&
31903189
listenToNonDelegatedEvent("scroll", instance);
3191-
i = null;
3192-
var children = props.children;
3193-
if (
3194-
("string" === typeof children || "number" === typeof children) &&
3195-
instance.textContent !== "" + children
3196-
) {
3197-
if (!0 !== props.suppressHydrationWarning) {
3198-
var serverText = instance.textContent;
3199-
normalizeMarkupForTextOrAttribute(children);
3200-
normalizeMarkupForTextOrAttribute(serverText);
3201-
}
3202-
isConcurrentMode || (i = ["children", children]);
3203-
}
3190+
var updatePayload = null;
3191+
i = props.children;
3192+
("string" !== typeof i && "number" !== typeof i) ||
3193+
instance.textContent === "" + i ||
3194+
(!0 !== props.suppressHydrationWarning &&
3195+
((updatePayload = instance.textContent),
3196+
normalizeMarkupForTextOrAttribute(i),
3197+
normalizeMarkupForTextOrAttribute(updatePayload)),
3198+
(updatePayload = ["children", i]));
32043199
switch (type) {
32053200
case "input":
32063201
track(instance);
@@ -3216,7 +3211,7 @@ function prepareToHydrateHostInstance(fiber) {
32163211
default:
32173212
"function" === typeof props.onClick && (instance.onclick = noop$1);
32183213
}
3219-
instance = i;
3214+
instance = updatePayload;
32203215
fiber.updateQueue = instance;
32213216
return null !== instance ? !0 : !1;
32223217
}
@@ -8109,43 +8104,25 @@ function completeWork(current, workInProgress, renderLanes) {
81098104
throw Error(formatProdErrorMessage(166));
81108105
current = rootInstanceStackCursor.current;
81118106
if (popHydrationState(workInProgress)) {
8112-
a: {
8113-
newProps = workInProgress.stateNode;
8114-
current = workInProgress.memoizedProps;
8115-
newProps[internalInstanceKey] = workInProgress;
8116-
if ((renderLanes = newProps.nodeValue !== current)) {
8117-
var returnFiber = hydrationParentFiber;
8118-
if (null !== returnFiber)
8119-
switch (returnFiber.tag) {
8120-
case 3:
8121-
type = 0 !== (returnFiber.mode & 1);
8122-
newProps = newProps.nodeValue;
8123-
normalizeMarkupForTextOrAttribute(current);
8124-
normalizeMarkupForTextOrAttribute(newProps);
8125-
if (type) {
8126-
current = !1;
8127-
break a;
8128-
}
8129-
break;
8130-
case 27:
8131-
case 5:
8132-
if (
8133-
((type = 0 !== (returnFiber.mode & 1)),
8134-
!0 !==
8135-
returnFiber.memoizedProps.suppressHydrationWarning &&
8136-
((newProps = newProps.nodeValue),
8137-
normalizeMarkupForTextOrAttribute(current),
8138-
normalizeMarkupForTextOrAttribute(newProps)),
8139-
type)
8140-
) {
8141-
current = !1;
8142-
break a;
8143-
}
8144-
}
8145-
}
8146-
current = renderLanes;
8147-
}
8148-
current && markUpdate(workInProgress);
8107+
newProps = workInProgress.stateNode;
8108+
current = workInProgress.memoizedProps;
8109+
newProps[internalInstanceKey] = workInProgress;
8110+
if ((renderLanes = newProps.nodeValue !== current))
8111+
if (((type = hydrationParentFiber), null !== type))
8112+
switch (type.tag) {
8113+
case 3:
8114+
newProps = newProps.nodeValue;
8115+
normalizeMarkupForTextOrAttribute(current);
8116+
normalizeMarkupForTextOrAttribute(newProps);
8117+
break;
8118+
case 27:
8119+
case 5:
8120+
!0 !== type.memoizedProps.suppressHydrationWarning &&
8121+
((newProps = newProps.nodeValue),
8122+
normalizeMarkupForTextOrAttribute(current),
8123+
normalizeMarkupForTextOrAttribute(newProps));
8124+
}
8125+
renderLanes && markUpdate(workInProgress);
81498126
} else
81508127
(current =
81518128
getOwnerDocumentFromRootContainer(current).createTextNode(
@@ -8201,18 +8178,19 @@ function completeWork(current, workInProgress, renderLanes) {
82018178
return (workInProgress.lanes = renderLanes), workInProgress;
82028179
renderLanes = null !== newProps;
82038180
current = null !== current && null !== current.memoizedState;
8204-
renderLanes &&
8205-
((newProps = workInProgress.child),
8206-
(type = null),
8181+
if (renderLanes) {
8182+
newProps = workInProgress.child;
8183+
type = null;
82078184
null !== newProps.alternate &&
82088185
null !== newProps.alternate.memoizedState &&
82098186
null !== newProps.alternate.memoizedState.cachePool &&
8210-
(type = newProps.alternate.memoizedState.cachePool.pool),
8211-
(returnFiber = null),
8187+
(type = newProps.alternate.memoizedState.cachePool.pool);
8188+
var cache$142 = null;
82128189
null !== newProps.memoizedState &&
82138190
null !== newProps.memoizedState.cachePool &&
8214-
(returnFiber = newProps.memoizedState.cachePool.pool),
8215-
returnFiber !== type && (newProps.flags |= 2048));
8191+
(cache$142 = newProps.memoizedState.cachePool.pool);
8192+
cache$142 !== type && (newProps.flags |= 2048);
8193+
}
82168194
renderLanes !== current &&
82178195
(enableTransitionTracing && (workInProgress.child.flags |= 2048),
82188196
renderLanes && (workInProgress.child.flags |= 8192));
@@ -8247,20 +8225,20 @@ function completeWork(current, workInProgress, renderLanes) {
82478225
type = workInProgress.memoizedState;
82488226
if (null === type) return bubbleProperties(workInProgress), null;
82498227
newProps = 0 !== (workInProgress.flags & 128);
8250-
returnFiber = type.rendering;
8251-
if (null === returnFiber)
8228+
cache$142 = type.rendering;
8229+
if (null === cache$142)
82528230
if (newProps) cutOffTailIfNeeded(type, !1);
82538231
else {
82548232
if (
82558233
0 !== workInProgressRootExitStatus ||
82568234
(null !== current && 0 !== (current.flags & 128))
82578235
)
82588236
for (current = workInProgress.child; null !== current; ) {
8259-
returnFiber = findFirstSuspended(current);
8260-
if (null !== returnFiber) {
8237+
cache$142 = findFirstSuspended(current);
8238+
if (null !== cache$142) {
82618239
workInProgress.flags |= 128;
82628240
cutOffTailIfNeeded(type, !1);
8263-
current = returnFiber.updateQueue;
8241+
current = cache$142.updateQueue;
82648242
workInProgress.updateQueue = current;
82658243
scheduleRetryEffect(workInProgress, current);
82668244
workInProgress.subtreeFlags = 0;
@@ -8285,7 +8263,7 @@ function completeWork(current, workInProgress, renderLanes) {
82858263
}
82868264
else {
82878265
if (!newProps)
8288-
if (((current = findFirstSuspended(returnFiber)), null !== current)) {
8266+
if (((current = findFirstSuspended(cache$142)), null !== current)) {
82898267
if (
82908268
((workInProgress.flags |= 128),
82918269
(newProps = !0),
@@ -8295,7 +8273,7 @@ function completeWork(current, workInProgress, renderLanes) {
82958273
cutOffTailIfNeeded(type, !0),
82968274
null === type.tail &&
82978275
"hidden" === type.tailMode &&
8298-
!returnFiber.alternate &&
8276+
!cache$142.alternate &&
82998277
!isHydrating)
83008278
)
83018279
return bubbleProperties(workInProgress), null;
@@ -8308,13 +8286,13 @@ function completeWork(current, workInProgress, renderLanes) {
83088286
cutOffTailIfNeeded(type, !1),
83098287
(workInProgress.lanes = 8388608));
83108288
type.isBackwards
8311-
? ((returnFiber.sibling = workInProgress.child),
8312-
(workInProgress.child = returnFiber))
8289+
? ((cache$142.sibling = workInProgress.child),
8290+
(workInProgress.child = cache$142))
83138291
: ((current = type.last),
83148292
null !== current
8315-
? (current.sibling = returnFiber)
8316-
: (workInProgress.child = returnFiber),
8317-
(type.last = returnFiber));
8293+
? (current.sibling = cache$142)
8294+
: (workInProgress.child = cache$142),
8295+
(type.last = cache$142));
83188296
}
83198297
if (null !== type.tail)
83208298
return (
@@ -15830,7 +15808,7 @@ Internals.Events = [
1583015808
var devToolsConfig$jscomp$inline_1775 = {
1583115809
findFiberByHostInstance: getClosestInstanceFromNode,
1583215810
bundleType: 0,
15833-
version: "18.3.0-www-classic-0ef6286c",
15811+
version: "18.3.0-www-classic-1f5575cc",
1583415812
rendererPackageName: "react-dom"
1583515813
};
1583615814
var internals$jscomp$inline_2155 = {
@@ -15860,7 +15838,7 @@ var internals$jscomp$inline_2155 = {
1586015838
scheduleRoot: null,
1586115839
setRefreshHandler: null,
1586215840
getCurrentFiber: null,
15863-
reconcilerVersion: "18.3.0-www-classic-0ef6286c"
15841+
reconcilerVersion: "18.3.0-www-classic-1f5575cc"
1586415842
};
1586515843
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1586615844
var hook$jscomp$inline_2156 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -16100,4 +16078,4 @@ exports.unstable_renderSubtreeIntoContainer = function (
1610016078
);
1610116079
};
1610216080
exports.unstable_runWithPriority = runWithPriority;
16103-
exports.version = "18.3.0-www-classic-0ef6286c";
16081+
exports.version = "18.3.0-www-classic-1f5575cc";

0 commit comments

Comments
 (0)