mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Fix uSES hydration in strict mode (#26791)
Previously, we'd call and use getSnapshot on the second render resulting
in `Warning: Text content did not match. Server: "Nay!" Client: "Yay!"`
and then `Error: Text content does not match server-rendered HTML.`.
Fixes #26095. Closes #26113. Closes #25650.
---------
Co-authored-by: eps1lon <silbermann.sebastian@gmail.com>
DiffTrain build for [4cd7065665](https://github.com/facebook/react/commit/4cd7065665ea2cf33c306265c8d817904bb401ca)
This commit is contained in:
@@ -1 +1 @@
|
||||
df12d7eac40c87bd5fdde0aa5a739bce9e7dce27
|
||||
4cd7065665ea2cf33c306265c8d817904bb401ca
|
||||
|
||||
@@ -27,7 +27,7 @@ if (
|
||||
}
|
||||
"use strict";
|
||||
|
||||
var ReactVersion = "18.3.0-www-modern-bc9d666a";
|
||||
var ReactVersion = "18.3.0-www-modern-6995898a";
|
||||
|
||||
// ATTENTION
|
||||
// When adding new symbols to this file,
|
||||
|
||||
@@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
|
||||
return self;
|
||||
}
|
||||
|
||||
var ReactVersion = "18.3.0-www-classic-e1e0fe51";
|
||||
var ReactVersion = "18.3.0-www-classic-d297891e";
|
||||
|
||||
var LegacyRoot = 0;
|
||||
var ConcurrentRoot = 1;
|
||||
@@ -9250,8 +9250,6 @@ function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
// clean-up function, and we track the deps correctly, we can call pushEffect
|
||||
// directly, without storing any additional state. For the same reason, we
|
||||
// don't need to set a static flag, either.
|
||||
// TODO: We can move this to the passive phase once we add a pre-commit
|
||||
// consistency check. See the next comment.
|
||||
|
||||
fiber.flags |= Passive$1;
|
||||
pushEffect(
|
||||
@@ -9269,18 +9267,22 @@ function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
// normal rules of React, and only works because store updates are
|
||||
// always synchronous.
|
||||
|
||||
var nextSnapshot = getSnapshot();
|
||||
var nextSnapshot;
|
||||
|
||||
{
|
||||
if (!didWarnUncachedGetSnapshot) {
|
||||
var cachedSnapshot = getSnapshot();
|
||||
nextSnapshot = getSnapshot();
|
||||
|
||||
if (!objectIs(nextSnapshot, cachedSnapshot)) {
|
||||
error(
|
||||
"The result of getSnapshot should be cached to avoid an infinite loop"
|
||||
);
|
||||
{
|
||||
if (!didWarnUncachedGetSnapshot) {
|
||||
var cachedSnapshot = getSnapshot();
|
||||
|
||||
didWarnUncachedGetSnapshot = true;
|
||||
if (!objectIs(nextSnapshot, cachedSnapshot)) {
|
||||
error(
|
||||
"The result of getSnapshot should be cached to avoid an infinite loop"
|
||||
);
|
||||
|
||||
didWarnUncachedGetSnapshot = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9303,7 +9305,7 @@ function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
|
||||
if (
|
||||
inst.getSnapshot !== getSnapshot ||
|
||||
snapshotChanged || // Check if the susbcribe function changed. We can save some memory by
|
||||
snapshotChanged || // Check if the subscribe function changed. We can save some memory by
|
||||
// checking whether we scheduled a subscription effect above.
|
||||
(workInProgressHook !== null &&
|
||||
workInProgressHook.memoizedState.tag & HasEffect)
|
||||
@@ -9645,7 +9647,8 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) {
|
||||
var hook = updateWorkInProgressHook();
|
||||
var nextDeps = deps === undefined ? null : deps;
|
||||
var effect = hook.memoizedState;
|
||||
var inst = effect.inst; // currentHook is null when rerendering after a render phase state update.
|
||||
var inst = effect.inst; // currentHook is null on initial mount when rerendering after a render phase
|
||||
// state update or for strict mode.
|
||||
|
||||
if (currentHook !== null) {
|
||||
if (nextDeps !== null) {
|
||||
|
||||
@@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
|
||||
return self;
|
||||
}
|
||||
|
||||
var ReactVersion = "18.3.0-www-modern-f0df93d6";
|
||||
var ReactVersion = "18.3.0-www-modern-2f2a7948";
|
||||
|
||||
var LegacyRoot = 0;
|
||||
var ConcurrentRoot = 1;
|
||||
@@ -9006,8 +9006,6 @@ function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
// clean-up function, and we track the deps correctly, we can call pushEffect
|
||||
// directly, without storing any additional state. For the same reason, we
|
||||
// don't need to set a static flag, either.
|
||||
// TODO: We can move this to the passive phase once we add a pre-commit
|
||||
// consistency check. See the next comment.
|
||||
|
||||
fiber.flags |= Passive$1;
|
||||
pushEffect(
|
||||
@@ -9025,18 +9023,22 @@ function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
// normal rules of React, and only works because store updates are
|
||||
// always synchronous.
|
||||
|
||||
var nextSnapshot = getSnapshot();
|
||||
var nextSnapshot;
|
||||
|
||||
{
|
||||
if (!didWarnUncachedGetSnapshot) {
|
||||
var cachedSnapshot = getSnapshot();
|
||||
nextSnapshot = getSnapshot();
|
||||
|
||||
if (!objectIs(nextSnapshot, cachedSnapshot)) {
|
||||
error(
|
||||
"The result of getSnapshot should be cached to avoid an infinite loop"
|
||||
);
|
||||
{
|
||||
if (!didWarnUncachedGetSnapshot) {
|
||||
var cachedSnapshot = getSnapshot();
|
||||
|
||||
didWarnUncachedGetSnapshot = true;
|
||||
if (!objectIs(nextSnapshot, cachedSnapshot)) {
|
||||
error(
|
||||
"The result of getSnapshot should be cached to avoid an infinite loop"
|
||||
);
|
||||
|
||||
didWarnUncachedGetSnapshot = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9059,7 +9061,7 @@ function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
|
||||
if (
|
||||
inst.getSnapshot !== getSnapshot ||
|
||||
snapshotChanged || // Check if the susbcribe function changed. We can save some memory by
|
||||
snapshotChanged || // Check if the subscribe function changed. We can save some memory by
|
||||
// checking whether we scheduled a subscription effect above.
|
||||
(workInProgressHook !== null &&
|
||||
workInProgressHook.memoizedState.tag & HasEffect)
|
||||
@@ -9401,7 +9403,8 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) {
|
||||
var hook = updateWorkInProgressHook();
|
||||
var nextDeps = deps === undefined ? null : deps;
|
||||
var effect = hook.memoizedState;
|
||||
var inst = effect.inst; // currentHook is null when rerendering after a render phase state update.
|
||||
var inst = effect.inst; // currentHook is null on initial mount when rerendering after a render phase
|
||||
// state update or for strict mode.
|
||||
|
||||
if (currentHook !== null) {
|
||||
if (nextDeps !== null) {
|
||||
|
||||
@@ -2971,12 +2971,12 @@ function updateMutableSource(source, getSnapshot, subscribe) {
|
||||
}
|
||||
function updateSyncExternalStore(subscribe, getSnapshot) {
|
||||
var fiber = currentlyRenderingFiber$1,
|
||||
hook = updateWorkInProgressHook(),
|
||||
nextSnapshot = getSnapshot(),
|
||||
snapshotChanged = !objectIs(
|
||||
(currentHook || hook).memoizedState,
|
||||
nextSnapshot
|
||||
);
|
||||
hook = updateWorkInProgressHook();
|
||||
var nextSnapshot = getSnapshot();
|
||||
var snapshotChanged = !objectIs(
|
||||
(currentHook || hook).memoizedState,
|
||||
nextSnapshot
|
||||
);
|
||||
snapshotChanged &&
|
||||
((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0));
|
||||
hook = hook.queue;
|
||||
@@ -10193,7 +10193,7 @@ var slice = Array.prototype.slice,
|
||||
return null;
|
||||
},
|
||||
bundleType: 0,
|
||||
version: "18.3.0-www-classic-b2a7bab7",
|
||||
version: "18.3.0-www-classic-06adf47d",
|
||||
rendererPackageName: "react-art"
|
||||
};
|
||||
var internals$jscomp$inline_1325 = {
|
||||
@@ -10224,7 +10224,7 @@ var internals$jscomp$inline_1325 = {
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "18.3.0-www-classic-b2a7bab7"
|
||||
reconcilerVersion: "18.3.0-www-classic-06adf47d"
|
||||
};
|
||||
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
var hook$jscomp$inline_1326 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
|
||||
@@ -2777,12 +2777,12 @@ function updateMutableSource(source, getSnapshot, subscribe) {
|
||||
}
|
||||
function updateSyncExternalStore(subscribe, getSnapshot) {
|
||||
var fiber = currentlyRenderingFiber$1,
|
||||
hook = updateWorkInProgressHook(),
|
||||
nextSnapshot = getSnapshot(),
|
||||
snapshotChanged = !objectIs(
|
||||
(currentHook || hook).memoizedState,
|
||||
nextSnapshot
|
||||
);
|
||||
hook = updateWorkInProgressHook();
|
||||
var nextSnapshot = getSnapshot();
|
||||
var snapshotChanged = !objectIs(
|
||||
(currentHook || hook).memoizedState,
|
||||
nextSnapshot
|
||||
);
|
||||
snapshotChanged &&
|
||||
((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0));
|
||||
hook = hook.queue;
|
||||
@@ -9858,7 +9858,7 @@ var slice = Array.prototype.slice,
|
||||
return null;
|
||||
},
|
||||
bundleType: 0,
|
||||
version: "18.3.0-www-modern-50ab1d1d",
|
||||
version: "18.3.0-www-modern-899090e3",
|
||||
rendererPackageName: "react-art"
|
||||
};
|
||||
var internals$jscomp$inline_1305 = {
|
||||
@@ -9889,7 +9889,7 @@ var internals$jscomp$inline_1305 = {
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "18.3.0-www-modern-50ab1d1d"
|
||||
reconcilerVersion: "18.3.0-www-modern-899090e3"
|
||||
};
|
||||
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
var hook$jscomp$inline_1306 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
|
||||
@@ -13799,8 +13799,6 @@ function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
// clean-up function, and we track the deps correctly, we can call pushEffect
|
||||
// directly, without storing any additional state. For the same reason, we
|
||||
// don't need to set a static flag, either.
|
||||
// TODO: We can move this to the passive phase once we add a pre-commit
|
||||
// consistency check. See the next comment.
|
||||
|
||||
fiber.flags |= Passive$1;
|
||||
pushEffect(
|
||||
@@ -13818,18 +13816,33 @@ function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
// normal rules of React, and only works because store updates are
|
||||
// always synchronous.
|
||||
|
||||
var nextSnapshot = getSnapshot();
|
||||
var nextSnapshot;
|
||||
var isHydrating = getIsHydrating();
|
||||
|
||||
{
|
||||
if (!didWarnUncachedGetSnapshot) {
|
||||
var cachedSnapshot = getSnapshot();
|
||||
if (isHydrating) {
|
||||
// Needed for strict mode double render
|
||||
if (getServerSnapshot === undefined) {
|
||||
throw new Error(
|
||||
"Missing getServerSnapshot, which is required for " +
|
||||
"server-rendered content. Will revert to client rendering."
|
||||
);
|
||||
}
|
||||
|
||||
if (!objectIs(nextSnapshot, cachedSnapshot)) {
|
||||
error(
|
||||
"The result of getSnapshot should be cached to avoid an infinite loop"
|
||||
);
|
||||
nextSnapshot = getServerSnapshot();
|
||||
} else {
|
||||
nextSnapshot = getSnapshot();
|
||||
|
||||
didWarnUncachedGetSnapshot = true;
|
||||
{
|
||||
if (!didWarnUncachedGetSnapshot) {
|
||||
var cachedSnapshot = getSnapshot();
|
||||
|
||||
if (!objectIs(nextSnapshot, cachedSnapshot)) {
|
||||
error(
|
||||
"The result of getSnapshot should be cached to avoid an infinite loop"
|
||||
);
|
||||
|
||||
didWarnUncachedGetSnapshot = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13852,7 +13865,7 @@ function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
|
||||
if (
|
||||
inst.getSnapshot !== getSnapshot ||
|
||||
snapshotChanged || // Check if the susbcribe function changed. We can save some memory by
|
||||
snapshotChanged || // Check if the subscribe function changed. We can save some memory by
|
||||
// checking whether we scheduled a subscription effect above.
|
||||
(workInProgressHook !== null &&
|
||||
workInProgressHook.memoizedState.tag & HasEffect)
|
||||
@@ -13875,7 +13888,7 @@ function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
);
|
||||
}
|
||||
|
||||
if (!includesBlockingLane(root, renderLanes$1)) {
|
||||
if (!isHydrating && !includesBlockingLane(root, renderLanes$1)) {
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
}
|
||||
}
|
||||
@@ -14194,7 +14207,8 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) {
|
||||
var hook = updateWorkInProgressHook();
|
||||
var nextDeps = deps === undefined ? null : deps;
|
||||
var effect = hook.memoizedState;
|
||||
var inst = effect.inst; // currentHook is null when rerendering after a render phase state update.
|
||||
var inst = effect.inst; // currentHook is null on initial mount when rerendering after a render phase
|
||||
// state update or for strict mode.
|
||||
|
||||
if (currentHook !== null) {
|
||||
if (nextDeps !== null) {
|
||||
@@ -15443,7 +15457,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
||||
useSyncExternalStore: function (subscribe, getSnapshot, getServerSnapshot) {
|
||||
currentHookNameInDev = "useSyncExternalStore";
|
||||
updateHookTypesDev();
|
||||
return updateSyncExternalStore(subscribe, getSnapshot);
|
||||
return updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
||||
},
|
||||
useId: function () {
|
||||
currentHookNameInDev = "useId";
|
||||
@@ -15587,7 +15601,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
||||
useSyncExternalStore: function (subscribe, getSnapshot, getServerSnapshot) {
|
||||
currentHookNameInDev = "useSyncExternalStore";
|
||||
updateHookTypesDev();
|
||||
return updateSyncExternalStore(subscribe, getSnapshot);
|
||||
return updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
||||
},
|
||||
useId: function () {
|
||||
currentHookNameInDev = "useId";
|
||||
@@ -15918,7 +15932,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
||||
currentHookNameInDev = "useSyncExternalStore";
|
||||
warnInvalidHookAccess();
|
||||
updateHookTypesDev();
|
||||
return updateSyncExternalStore(subscribe, getSnapshot);
|
||||
return updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
||||
},
|
||||
useId: function () {
|
||||
currentHookNameInDev = "useId";
|
||||
@@ -16085,7 +16099,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
||||
currentHookNameInDev = "useSyncExternalStore";
|
||||
warnInvalidHookAccess();
|
||||
updateHookTypesDev();
|
||||
return updateSyncExternalStore(subscribe, getSnapshot);
|
||||
return updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
||||
},
|
||||
useId: function () {
|
||||
currentHookNameInDev = "useId";
|
||||
@@ -34168,7 +34182,7 @@ function createFiberRoot(
|
||||
return root;
|
||||
}
|
||||
|
||||
var ReactVersion = "18.3.0-www-classic-b6d18d0e";
|
||||
var ReactVersion = "18.3.0-www-classic-340ebf62";
|
||||
|
||||
function createPortal$1(
|
||||
children,
|
||||
|
||||
@@ -13740,8 +13740,6 @@ function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
// clean-up function, and we track the deps correctly, we can call pushEffect
|
||||
// directly, without storing any additional state. For the same reason, we
|
||||
// don't need to set a static flag, either.
|
||||
// TODO: We can move this to the passive phase once we add a pre-commit
|
||||
// consistency check. See the next comment.
|
||||
|
||||
fiber.flags |= Passive$1;
|
||||
pushEffect(
|
||||
@@ -13759,18 +13757,33 @@ function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
// normal rules of React, and only works because store updates are
|
||||
// always synchronous.
|
||||
|
||||
var nextSnapshot = getSnapshot();
|
||||
var nextSnapshot;
|
||||
var isHydrating = getIsHydrating();
|
||||
|
||||
{
|
||||
if (!didWarnUncachedGetSnapshot) {
|
||||
var cachedSnapshot = getSnapshot();
|
||||
if (isHydrating) {
|
||||
// Needed for strict mode double render
|
||||
if (getServerSnapshot === undefined) {
|
||||
throw new Error(
|
||||
"Missing getServerSnapshot, which is required for " +
|
||||
"server-rendered content. Will revert to client rendering."
|
||||
);
|
||||
}
|
||||
|
||||
if (!objectIs(nextSnapshot, cachedSnapshot)) {
|
||||
error(
|
||||
"The result of getSnapshot should be cached to avoid an infinite loop"
|
||||
);
|
||||
nextSnapshot = getServerSnapshot();
|
||||
} else {
|
||||
nextSnapshot = getSnapshot();
|
||||
|
||||
didWarnUncachedGetSnapshot = true;
|
||||
{
|
||||
if (!didWarnUncachedGetSnapshot) {
|
||||
var cachedSnapshot = getSnapshot();
|
||||
|
||||
if (!objectIs(nextSnapshot, cachedSnapshot)) {
|
||||
error(
|
||||
"The result of getSnapshot should be cached to avoid an infinite loop"
|
||||
);
|
||||
|
||||
didWarnUncachedGetSnapshot = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13793,7 +13806,7 @@ function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
|
||||
if (
|
||||
inst.getSnapshot !== getSnapshot ||
|
||||
snapshotChanged || // Check if the susbcribe function changed. We can save some memory by
|
||||
snapshotChanged || // Check if the subscribe function changed. We can save some memory by
|
||||
// checking whether we scheduled a subscription effect above.
|
||||
(workInProgressHook !== null &&
|
||||
workInProgressHook.memoizedState.tag & HasEffect)
|
||||
@@ -13816,7 +13829,7 @@ function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
);
|
||||
}
|
||||
|
||||
if (!includesBlockingLane(root, renderLanes$1)) {
|
||||
if (!isHydrating && !includesBlockingLane(root, renderLanes$1)) {
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
}
|
||||
}
|
||||
@@ -14135,7 +14148,8 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) {
|
||||
var hook = updateWorkInProgressHook();
|
||||
var nextDeps = deps === undefined ? null : deps;
|
||||
var effect = hook.memoizedState;
|
||||
var inst = effect.inst; // currentHook is null when rerendering after a render phase state update.
|
||||
var inst = effect.inst; // currentHook is null on initial mount when rerendering after a render phase
|
||||
// state update or for strict mode.
|
||||
|
||||
if (currentHook !== null) {
|
||||
if (nextDeps !== null) {
|
||||
@@ -15384,7 +15398,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
||||
useSyncExternalStore: function (subscribe, getSnapshot, getServerSnapshot) {
|
||||
currentHookNameInDev = "useSyncExternalStore";
|
||||
updateHookTypesDev();
|
||||
return updateSyncExternalStore(subscribe, getSnapshot);
|
||||
return updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
||||
},
|
||||
useId: function () {
|
||||
currentHookNameInDev = "useId";
|
||||
@@ -15528,7 +15542,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
||||
useSyncExternalStore: function (subscribe, getSnapshot, getServerSnapshot) {
|
||||
currentHookNameInDev = "useSyncExternalStore";
|
||||
updateHookTypesDev();
|
||||
return updateSyncExternalStore(subscribe, getSnapshot);
|
||||
return updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
||||
},
|
||||
useId: function () {
|
||||
currentHookNameInDev = "useId";
|
||||
@@ -15859,7 +15873,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
||||
currentHookNameInDev = "useSyncExternalStore";
|
||||
warnInvalidHookAccess();
|
||||
updateHookTypesDev();
|
||||
return updateSyncExternalStore(subscribe, getSnapshot);
|
||||
return updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
||||
},
|
||||
useId: function () {
|
||||
currentHookNameInDev = "useId";
|
||||
@@ -16026,7 +16040,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
||||
currentHookNameInDev = "useSyncExternalStore";
|
||||
warnInvalidHookAccess();
|
||||
updateHookTypesDev();
|
||||
return updateSyncExternalStore(subscribe, getSnapshot);
|
||||
return updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
||||
},
|
||||
useId: function () {
|
||||
currentHookNameInDev = "useId";
|
||||
@@ -34013,7 +34027,7 @@ function createFiberRoot(
|
||||
return root;
|
||||
}
|
||||
|
||||
var ReactVersion = "18.3.0-www-modern-50ab1d1d";
|
||||
var ReactVersion = "18.3.0-www-modern-899090e3";
|
||||
|
||||
function createPortal$1(
|
||||
children,
|
||||
|
||||
@@ -3772,16 +3772,20 @@ function updateMutableSource(source, getSnapshot, subscribe) {
|
||||
var hook = updateWorkInProgressHook();
|
||||
return useMutableSource(hook, source, getSnapshot, subscribe);
|
||||
}
|
||||
function updateSyncExternalStore(subscribe, getSnapshot) {
|
||||
function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
var fiber = currentlyRenderingFiber$1,
|
||||
hook = updateWorkInProgressHook(),
|
||||
nextSnapshot = getSnapshot(),
|
||||
snapshotChanged = !objectIs(
|
||||
(currentHook || hook).memoizedState,
|
||||
nextSnapshot
|
||||
);
|
||||
isHydrating$jscomp$0 = isHydrating;
|
||||
if (isHydrating$jscomp$0) {
|
||||
if (void 0 === getServerSnapshot) throw Error(formatProdErrorMessage(407));
|
||||
getServerSnapshot = getServerSnapshot();
|
||||
} else getServerSnapshot = getSnapshot();
|
||||
var snapshotChanged = !objectIs(
|
||||
(currentHook || hook).memoizedState,
|
||||
getServerSnapshot
|
||||
);
|
||||
snapshotChanged &&
|
||||
((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0));
|
||||
((hook.memoizedState = getServerSnapshot), (didReceiveUpdate = !0));
|
||||
hook = hook.queue;
|
||||
updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [
|
||||
subscribe
|
||||
@@ -3794,16 +3798,23 @@ function updateSyncExternalStore(subscribe, getSnapshot) {
|
||||
fiber.flags |= 2048;
|
||||
pushEffect(
|
||||
9,
|
||||
updateStoreInstance.bind(null, fiber, hook, nextSnapshot, getSnapshot),
|
||||
updateStoreInstance.bind(
|
||||
null,
|
||||
fiber,
|
||||
hook,
|
||||
getServerSnapshot,
|
||||
getSnapshot
|
||||
),
|
||||
{ destroy: void 0 },
|
||||
null
|
||||
);
|
||||
subscribe = workInProgressRoot;
|
||||
if (null === subscribe) throw Error(formatProdErrorMessage(349));
|
||||
includesBlockingLane(subscribe, renderLanes$1) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
isHydrating$jscomp$0 ||
|
||||
includesBlockingLane(subscribe, renderLanes$1) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot);
|
||||
}
|
||||
return nextSnapshot;
|
||||
return getServerSnapshot;
|
||||
}
|
||||
function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) {
|
||||
fiber.flags |= 16384;
|
||||
@@ -16642,7 +16653,7 @@ Internals.Events = [
|
||||
var devToolsConfig$jscomp$inline_1829 = {
|
||||
findFiberByHostInstance: getClosestInstanceFromNode,
|
||||
bundleType: 0,
|
||||
version: "18.3.0-www-classic-fbb135ff",
|
||||
version: "18.3.0-www-classic-f5d45791",
|
||||
rendererPackageName: "react-dom"
|
||||
};
|
||||
var internals$jscomp$inline_2203 = {
|
||||
@@ -16672,7 +16683,7 @@ var internals$jscomp$inline_2203 = {
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "18.3.0-www-classic-fbb135ff"
|
||||
reconcilerVersion: "18.3.0-www-classic-f5d45791"
|
||||
};
|
||||
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
var hook$jscomp$inline_2204 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
@@ -16915,4 +16926,4 @@ exports.unstable_renderSubtreeIntoContainer = function (
|
||||
);
|
||||
};
|
||||
exports.unstable_runWithPriority = runWithPriority;
|
||||
exports.version = "18.3.0-www-classic-fbb135ff";
|
||||
exports.version = "18.3.0-www-classic-f5d45791";
|
||||
|
||||
@@ -3665,16 +3665,20 @@ function updateMutableSource(source, getSnapshot, subscribe) {
|
||||
var hook = updateWorkInProgressHook();
|
||||
return useMutableSource(hook, source, getSnapshot, subscribe);
|
||||
}
|
||||
function updateSyncExternalStore(subscribe, getSnapshot) {
|
||||
function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
var fiber = currentlyRenderingFiber$1,
|
||||
hook = updateWorkInProgressHook(),
|
||||
nextSnapshot = getSnapshot(),
|
||||
snapshotChanged = !objectIs(
|
||||
(currentHook || hook).memoizedState,
|
||||
nextSnapshot
|
||||
);
|
||||
isHydrating$jscomp$0 = isHydrating;
|
||||
if (isHydrating$jscomp$0) {
|
||||
if (void 0 === getServerSnapshot) throw Error(formatProdErrorMessage(407));
|
||||
getServerSnapshot = getServerSnapshot();
|
||||
} else getServerSnapshot = getSnapshot();
|
||||
var snapshotChanged = !objectIs(
|
||||
(currentHook || hook).memoizedState,
|
||||
getServerSnapshot
|
||||
);
|
||||
snapshotChanged &&
|
||||
((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0));
|
||||
((hook.memoizedState = getServerSnapshot), (didReceiveUpdate = !0));
|
||||
hook = hook.queue;
|
||||
updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [
|
||||
subscribe
|
||||
@@ -3687,16 +3691,23 @@ function updateSyncExternalStore(subscribe, getSnapshot) {
|
||||
fiber.flags |= 2048;
|
||||
pushEffect(
|
||||
9,
|
||||
updateStoreInstance.bind(null, fiber, hook, nextSnapshot, getSnapshot),
|
||||
updateStoreInstance.bind(
|
||||
null,
|
||||
fiber,
|
||||
hook,
|
||||
getServerSnapshot,
|
||||
getSnapshot
|
||||
),
|
||||
{ destroy: void 0 },
|
||||
null
|
||||
);
|
||||
subscribe = workInProgressRoot;
|
||||
if (null === subscribe) throw Error(formatProdErrorMessage(349));
|
||||
includesBlockingLane(subscribe, renderLanes$1) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
isHydrating$jscomp$0 ||
|
||||
includesBlockingLane(subscribe, renderLanes$1) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot);
|
||||
}
|
||||
return nextSnapshot;
|
||||
return getServerSnapshot;
|
||||
}
|
||||
function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) {
|
||||
fiber.flags |= 16384;
|
||||
@@ -16169,7 +16180,7 @@ Internals.Events = [
|
||||
var devToolsConfig$jscomp$inline_1788 = {
|
||||
findFiberByHostInstance: getClosestInstanceFromNode,
|
||||
bundleType: 0,
|
||||
version: "18.3.0-www-modern-8a5299e6",
|
||||
version: "18.3.0-www-modern-c54c7d5d",
|
||||
rendererPackageName: "react-dom"
|
||||
};
|
||||
var internals$jscomp$inline_2167 = {
|
||||
@@ -16200,7 +16211,7 @@ var internals$jscomp$inline_2167 = {
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "18.3.0-www-modern-8a5299e6"
|
||||
reconcilerVersion: "18.3.0-www-modern-c54c7d5d"
|
||||
};
|
||||
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
var hook$jscomp$inline_2168 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
@@ -16371,4 +16382,4 @@ exports.unstable_createEventHandle = function (type, options) {
|
||||
return eventHandle;
|
||||
};
|
||||
exports.unstable_runWithPriority = runWithPriority;
|
||||
exports.version = "18.3.0-www-modern-8a5299e6";
|
||||
exports.version = "18.3.0-www-modern-c54c7d5d";
|
||||
|
||||
@@ -3918,16 +3918,20 @@ function updateMutableSource(source, getSnapshot, subscribe) {
|
||||
var hook = updateWorkInProgressHook();
|
||||
return useMutableSource(hook, source, getSnapshot, subscribe);
|
||||
}
|
||||
function updateSyncExternalStore(subscribe, getSnapshot) {
|
||||
function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
var fiber = currentlyRenderingFiber$1,
|
||||
hook = updateWorkInProgressHook(),
|
||||
nextSnapshot = getSnapshot(),
|
||||
snapshotChanged = !objectIs(
|
||||
(currentHook || hook).memoizedState,
|
||||
nextSnapshot
|
||||
);
|
||||
isHydrating$jscomp$0 = isHydrating;
|
||||
if (isHydrating$jscomp$0) {
|
||||
if (void 0 === getServerSnapshot) throw Error(formatProdErrorMessage(407));
|
||||
getServerSnapshot = getServerSnapshot();
|
||||
} else getServerSnapshot = getSnapshot();
|
||||
var snapshotChanged = !objectIs(
|
||||
(currentHook || hook).memoizedState,
|
||||
getServerSnapshot
|
||||
);
|
||||
snapshotChanged &&
|
||||
((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0));
|
||||
((hook.memoizedState = getServerSnapshot), (didReceiveUpdate = !0));
|
||||
hook = hook.queue;
|
||||
updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [
|
||||
subscribe
|
||||
@@ -3940,16 +3944,23 @@ function updateSyncExternalStore(subscribe, getSnapshot) {
|
||||
fiber.flags |= 2048;
|
||||
pushEffect(
|
||||
9,
|
||||
updateStoreInstance.bind(null, fiber, hook, nextSnapshot, getSnapshot),
|
||||
updateStoreInstance.bind(
|
||||
null,
|
||||
fiber,
|
||||
hook,
|
||||
getServerSnapshot,
|
||||
getSnapshot
|
||||
),
|
||||
{ destroy: void 0 },
|
||||
null
|
||||
);
|
||||
subscribe = workInProgressRoot;
|
||||
if (null === subscribe) throw Error(formatProdErrorMessage(349));
|
||||
includesBlockingLane(subscribe, renderLanes$1) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
isHydrating$jscomp$0 ||
|
||||
includesBlockingLane(subscribe, renderLanes$1) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot);
|
||||
}
|
||||
return nextSnapshot;
|
||||
return getServerSnapshot;
|
||||
}
|
||||
function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) {
|
||||
fiber.flags |= 16384;
|
||||
@@ -17417,7 +17428,7 @@ Internals.Events = [
|
||||
var devToolsConfig$jscomp$inline_1914 = {
|
||||
findFiberByHostInstance: getClosestInstanceFromNode,
|
||||
bundleType: 0,
|
||||
version: "18.3.0-www-classic-b9ad8cd3",
|
||||
version: "18.3.0-www-classic-214289fa",
|
||||
rendererPackageName: "react-dom"
|
||||
};
|
||||
(function (internals) {
|
||||
@@ -17461,7 +17472,7 @@ var devToolsConfig$jscomp$inline_1914 = {
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "18.3.0-www-classic-b9ad8cd3"
|
||||
reconcilerVersion: "18.3.0-www-classic-214289fa"
|
||||
});
|
||||
assign(Internals, {
|
||||
ReactBrowserEventEmitter: {
|
||||
@@ -17691,7 +17702,7 @@ exports.unstable_renderSubtreeIntoContainer = function (
|
||||
);
|
||||
};
|
||||
exports.unstable_runWithPriority = runWithPriority;
|
||||
exports.version = "18.3.0-www-classic-b9ad8cd3";
|
||||
exports.version = "18.3.0-www-classic-214289fa";
|
||||
|
||||
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
||||
if (
|
||||
|
||||
@@ -3811,16 +3811,20 @@ function updateMutableSource(source, getSnapshot, subscribe) {
|
||||
var hook = updateWorkInProgressHook();
|
||||
return useMutableSource(hook, source, getSnapshot, subscribe);
|
||||
}
|
||||
function updateSyncExternalStore(subscribe, getSnapshot) {
|
||||
function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
var fiber = currentlyRenderingFiber$1,
|
||||
hook = updateWorkInProgressHook(),
|
||||
nextSnapshot = getSnapshot(),
|
||||
snapshotChanged = !objectIs(
|
||||
(currentHook || hook).memoizedState,
|
||||
nextSnapshot
|
||||
);
|
||||
isHydrating$jscomp$0 = isHydrating;
|
||||
if (isHydrating$jscomp$0) {
|
||||
if (void 0 === getServerSnapshot) throw Error(formatProdErrorMessage(407));
|
||||
getServerSnapshot = getServerSnapshot();
|
||||
} else getServerSnapshot = getSnapshot();
|
||||
var snapshotChanged = !objectIs(
|
||||
(currentHook || hook).memoizedState,
|
||||
getServerSnapshot
|
||||
);
|
||||
snapshotChanged &&
|
||||
((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0));
|
||||
((hook.memoizedState = getServerSnapshot), (didReceiveUpdate = !0));
|
||||
hook = hook.queue;
|
||||
updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [
|
||||
subscribe
|
||||
@@ -3833,16 +3837,23 @@ function updateSyncExternalStore(subscribe, getSnapshot) {
|
||||
fiber.flags |= 2048;
|
||||
pushEffect(
|
||||
9,
|
||||
updateStoreInstance.bind(null, fiber, hook, nextSnapshot, getSnapshot),
|
||||
updateStoreInstance.bind(
|
||||
null,
|
||||
fiber,
|
||||
hook,
|
||||
getServerSnapshot,
|
||||
getSnapshot
|
||||
),
|
||||
{ destroy: void 0 },
|
||||
null
|
||||
);
|
||||
subscribe = workInProgressRoot;
|
||||
if (null === subscribe) throw Error(formatProdErrorMessage(349));
|
||||
includesBlockingLane(subscribe, renderLanes$1) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
isHydrating$jscomp$0 ||
|
||||
includesBlockingLane(subscribe, renderLanes$1) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot);
|
||||
}
|
||||
return nextSnapshot;
|
||||
return getServerSnapshot;
|
||||
}
|
||||
function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) {
|
||||
fiber.flags |= 16384;
|
||||
@@ -16938,7 +16949,7 @@ Internals.Events = [
|
||||
var devToolsConfig$jscomp$inline_1873 = {
|
||||
findFiberByHostInstance: getClosestInstanceFromNode,
|
||||
bundleType: 0,
|
||||
version: "18.3.0-www-modern-a64d6dfb",
|
||||
version: "18.3.0-www-modern-26883fc6",
|
||||
rendererPackageName: "react-dom"
|
||||
};
|
||||
(function (internals) {
|
||||
@@ -16983,7 +16994,7 @@ var devToolsConfig$jscomp$inline_1873 = {
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "18.3.0-www-modern-a64d6dfb"
|
||||
reconcilerVersion: "18.3.0-www-modern-26883fc6"
|
||||
});
|
||||
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
|
||||
exports.createPortal = function (children, container) {
|
||||
@@ -17141,7 +17152,7 @@ exports.unstable_createEventHandle = function (type, options) {
|
||||
return eventHandle;
|
||||
};
|
||||
exports.unstable_runWithPriority = runWithPriority;
|
||||
exports.version = "18.3.0-www-modern-a64d6dfb";
|
||||
exports.version = "18.3.0-www-modern-26883fc6";
|
||||
|
||||
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
||||
if (
|
||||
|
||||
@@ -13933,8 +13933,6 @@ function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
// clean-up function, and we track the deps correctly, we can call pushEffect
|
||||
// directly, without storing any additional state. For the same reason, we
|
||||
// don't need to set a static flag, either.
|
||||
// TODO: We can move this to the passive phase once we add a pre-commit
|
||||
// consistency check. See the next comment.
|
||||
|
||||
fiber.flags |= Passive$1;
|
||||
pushEffect(
|
||||
@@ -13952,18 +13950,33 @@ function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
// normal rules of React, and only works because store updates are
|
||||
// always synchronous.
|
||||
|
||||
var nextSnapshot = getSnapshot();
|
||||
var nextSnapshot;
|
||||
var isHydrating = getIsHydrating();
|
||||
|
||||
{
|
||||
if (!didWarnUncachedGetSnapshot) {
|
||||
var cachedSnapshot = getSnapshot();
|
||||
if (isHydrating) {
|
||||
// Needed for strict mode double render
|
||||
if (getServerSnapshot === undefined) {
|
||||
throw new Error(
|
||||
"Missing getServerSnapshot, which is required for " +
|
||||
"server-rendered content. Will revert to client rendering."
|
||||
);
|
||||
}
|
||||
|
||||
if (!objectIs(nextSnapshot, cachedSnapshot)) {
|
||||
error(
|
||||
"The result of getSnapshot should be cached to avoid an infinite loop"
|
||||
);
|
||||
nextSnapshot = getServerSnapshot();
|
||||
} else {
|
||||
nextSnapshot = getSnapshot();
|
||||
|
||||
didWarnUncachedGetSnapshot = true;
|
||||
{
|
||||
if (!didWarnUncachedGetSnapshot) {
|
||||
var cachedSnapshot = getSnapshot();
|
||||
|
||||
if (!objectIs(nextSnapshot, cachedSnapshot)) {
|
||||
error(
|
||||
"The result of getSnapshot should be cached to avoid an infinite loop"
|
||||
);
|
||||
|
||||
didWarnUncachedGetSnapshot = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13986,7 +13999,7 @@ function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
|
||||
if (
|
||||
inst.getSnapshot !== getSnapshot ||
|
||||
snapshotChanged || // Check if the susbcribe function changed. We can save some memory by
|
||||
snapshotChanged || // Check if the subscribe function changed. We can save some memory by
|
||||
// checking whether we scheduled a subscription effect above.
|
||||
(workInProgressHook !== null &&
|
||||
workInProgressHook.memoizedState.tag & HasEffect)
|
||||
@@ -14009,7 +14022,7 @@ function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
);
|
||||
}
|
||||
|
||||
if (!includesBlockingLane(root, renderLanes$1)) {
|
||||
if (!isHydrating && !includesBlockingLane(root, renderLanes$1)) {
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
}
|
||||
}
|
||||
@@ -14328,7 +14341,8 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) {
|
||||
var hook = updateWorkInProgressHook();
|
||||
var nextDeps = deps === undefined ? null : deps;
|
||||
var effect = hook.memoizedState;
|
||||
var inst = effect.inst; // currentHook is null when rerendering after a render phase state update.
|
||||
var inst = effect.inst; // currentHook is null on initial mount when rerendering after a render phase
|
||||
// state update or for strict mode.
|
||||
|
||||
if (currentHook !== null) {
|
||||
if (nextDeps !== null) {
|
||||
@@ -15577,7 +15591,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
||||
useSyncExternalStore: function (subscribe, getSnapshot, getServerSnapshot) {
|
||||
currentHookNameInDev = "useSyncExternalStore";
|
||||
updateHookTypesDev();
|
||||
return updateSyncExternalStore(subscribe, getSnapshot);
|
||||
return updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
||||
},
|
||||
useId: function () {
|
||||
currentHookNameInDev = "useId";
|
||||
@@ -15721,7 +15735,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
||||
useSyncExternalStore: function (subscribe, getSnapshot, getServerSnapshot) {
|
||||
currentHookNameInDev = "useSyncExternalStore";
|
||||
updateHookTypesDev();
|
||||
return updateSyncExternalStore(subscribe, getSnapshot);
|
||||
return updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
||||
},
|
||||
useId: function () {
|
||||
currentHookNameInDev = "useId";
|
||||
@@ -16052,7 +16066,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
||||
currentHookNameInDev = "useSyncExternalStore";
|
||||
warnInvalidHookAccess();
|
||||
updateHookTypesDev();
|
||||
return updateSyncExternalStore(subscribe, getSnapshot);
|
||||
return updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
||||
},
|
||||
useId: function () {
|
||||
currentHookNameInDev = "useId";
|
||||
@@ -16219,7 +16233,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
||||
currentHookNameInDev = "useSyncExternalStore";
|
||||
warnInvalidHookAccess();
|
||||
updateHookTypesDev();
|
||||
return updateSyncExternalStore(subscribe, getSnapshot);
|
||||
return updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
||||
},
|
||||
useId: function () {
|
||||
currentHookNameInDev = "useId";
|
||||
@@ -34785,7 +34799,7 @@ function createFiberRoot(
|
||||
return root;
|
||||
}
|
||||
|
||||
var ReactVersion = "18.3.0-www-classic-cc8acd04";
|
||||
var ReactVersion = "18.3.0-www-classic-02013e9c";
|
||||
|
||||
function createPortal$1(
|
||||
children,
|
||||
|
||||
@@ -13874,8 +13874,6 @@ function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
// clean-up function, and we track the deps correctly, we can call pushEffect
|
||||
// directly, without storing any additional state. For the same reason, we
|
||||
// don't need to set a static flag, either.
|
||||
// TODO: We can move this to the passive phase once we add a pre-commit
|
||||
// consistency check. See the next comment.
|
||||
|
||||
fiber.flags |= Passive$1;
|
||||
pushEffect(
|
||||
@@ -13893,18 +13891,33 @@ function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
// normal rules of React, and only works because store updates are
|
||||
// always synchronous.
|
||||
|
||||
var nextSnapshot = getSnapshot();
|
||||
var nextSnapshot;
|
||||
var isHydrating = getIsHydrating();
|
||||
|
||||
{
|
||||
if (!didWarnUncachedGetSnapshot) {
|
||||
var cachedSnapshot = getSnapshot();
|
||||
if (isHydrating) {
|
||||
// Needed for strict mode double render
|
||||
if (getServerSnapshot === undefined) {
|
||||
throw new Error(
|
||||
"Missing getServerSnapshot, which is required for " +
|
||||
"server-rendered content. Will revert to client rendering."
|
||||
);
|
||||
}
|
||||
|
||||
if (!objectIs(nextSnapshot, cachedSnapshot)) {
|
||||
error(
|
||||
"The result of getSnapshot should be cached to avoid an infinite loop"
|
||||
);
|
||||
nextSnapshot = getServerSnapshot();
|
||||
} else {
|
||||
nextSnapshot = getSnapshot();
|
||||
|
||||
didWarnUncachedGetSnapshot = true;
|
||||
{
|
||||
if (!didWarnUncachedGetSnapshot) {
|
||||
var cachedSnapshot = getSnapshot();
|
||||
|
||||
if (!objectIs(nextSnapshot, cachedSnapshot)) {
|
||||
error(
|
||||
"The result of getSnapshot should be cached to avoid an infinite loop"
|
||||
);
|
||||
|
||||
didWarnUncachedGetSnapshot = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13927,7 +13940,7 @@ function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
|
||||
if (
|
||||
inst.getSnapshot !== getSnapshot ||
|
||||
snapshotChanged || // Check if the susbcribe function changed. We can save some memory by
|
||||
snapshotChanged || // Check if the subscribe function changed. We can save some memory by
|
||||
// checking whether we scheduled a subscription effect above.
|
||||
(workInProgressHook !== null &&
|
||||
workInProgressHook.memoizedState.tag & HasEffect)
|
||||
@@ -13950,7 +13963,7 @@ function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
);
|
||||
}
|
||||
|
||||
if (!includesBlockingLane(root, renderLanes$1)) {
|
||||
if (!isHydrating && !includesBlockingLane(root, renderLanes$1)) {
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
}
|
||||
}
|
||||
@@ -14269,7 +14282,8 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) {
|
||||
var hook = updateWorkInProgressHook();
|
||||
var nextDeps = deps === undefined ? null : deps;
|
||||
var effect = hook.memoizedState;
|
||||
var inst = effect.inst; // currentHook is null when rerendering after a render phase state update.
|
||||
var inst = effect.inst; // currentHook is null on initial mount when rerendering after a render phase
|
||||
// state update or for strict mode.
|
||||
|
||||
if (currentHook !== null) {
|
||||
if (nextDeps !== null) {
|
||||
@@ -15518,7 +15532,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
||||
useSyncExternalStore: function (subscribe, getSnapshot, getServerSnapshot) {
|
||||
currentHookNameInDev = "useSyncExternalStore";
|
||||
updateHookTypesDev();
|
||||
return updateSyncExternalStore(subscribe, getSnapshot);
|
||||
return updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
||||
},
|
||||
useId: function () {
|
||||
currentHookNameInDev = "useId";
|
||||
@@ -15662,7 +15676,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
||||
useSyncExternalStore: function (subscribe, getSnapshot, getServerSnapshot) {
|
||||
currentHookNameInDev = "useSyncExternalStore";
|
||||
updateHookTypesDev();
|
||||
return updateSyncExternalStore(subscribe, getSnapshot);
|
||||
return updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
||||
},
|
||||
useId: function () {
|
||||
currentHookNameInDev = "useId";
|
||||
@@ -15993,7 +16007,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
||||
currentHookNameInDev = "useSyncExternalStore";
|
||||
warnInvalidHookAccess();
|
||||
updateHookTypesDev();
|
||||
return updateSyncExternalStore(subscribe, getSnapshot);
|
||||
return updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
||||
},
|
||||
useId: function () {
|
||||
currentHookNameInDev = "useId";
|
||||
@@ -16160,7 +16174,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
||||
currentHookNameInDev = "useSyncExternalStore";
|
||||
warnInvalidHookAccess();
|
||||
updateHookTypesDev();
|
||||
return updateSyncExternalStore(subscribe, getSnapshot);
|
||||
return updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
||||
},
|
||||
useId: function () {
|
||||
currentHookNameInDev = "useId";
|
||||
@@ -34630,7 +34644,7 @@ function createFiberRoot(
|
||||
return root;
|
||||
}
|
||||
|
||||
var ReactVersion = "18.3.0-www-modern-b5e9f35e";
|
||||
var ReactVersion = "18.3.0-www-modern-350137bf";
|
||||
|
||||
function createPortal$1(
|
||||
children,
|
||||
|
||||
@@ -3858,16 +3858,20 @@ function updateMutableSource(source, getSnapshot, subscribe) {
|
||||
var hook = updateWorkInProgressHook();
|
||||
return useMutableSource(hook, source, getSnapshot, subscribe);
|
||||
}
|
||||
function updateSyncExternalStore(subscribe, getSnapshot) {
|
||||
function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
var fiber = currentlyRenderingFiber$1,
|
||||
hook = updateWorkInProgressHook(),
|
||||
nextSnapshot = getSnapshot(),
|
||||
snapshotChanged = !objectIs(
|
||||
(currentHook || hook).memoizedState,
|
||||
nextSnapshot
|
||||
);
|
||||
isHydrating$jscomp$0 = isHydrating;
|
||||
if (isHydrating$jscomp$0) {
|
||||
if (void 0 === getServerSnapshot) throw Error(formatProdErrorMessage(407));
|
||||
getServerSnapshot = getServerSnapshot();
|
||||
} else getServerSnapshot = getSnapshot();
|
||||
var snapshotChanged = !objectIs(
|
||||
(currentHook || hook).memoizedState,
|
||||
getServerSnapshot
|
||||
);
|
||||
snapshotChanged &&
|
||||
((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0));
|
||||
((hook.memoizedState = getServerSnapshot), (didReceiveUpdate = !0));
|
||||
hook = hook.queue;
|
||||
updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [
|
||||
subscribe
|
||||
@@ -3880,16 +3884,23 @@ function updateSyncExternalStore(subscribe, getSnapshot) {
|
||||
fiber.flags |= 2048;
|
||||
pushEffect(
|
||||
9,
|
||||
updateStoreInstance.bind(null, fiber, hook, nextSnapshot, getSnapshot),
|
||||
updateStoreInstance.bind(
|
||||
null,
|
||||
fiber,
|
||||
hook,
|
||||
getServerSnapshot,
|
||||
getSnapshot
|
||||
),
|
||||
{ destroy: void 0 },
|
||||
null
|
||||
);
|
||||
subscribe = workInProgressRoot;
|
||||
if (null === subscribe) throw Error(formatProdErrorMessage(349));
|
||||
includesBlockingLane(subscribe, renderLanes$1) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
isHydrating$jscomp$0 ||
|
||||
includesBlockingLane(subscribe, renderLanes$1) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot);
|
||||
}
|
||||
return nextSnapshot;
|
||||
return getServerSnapshot;
|
||||
}
|
||||
function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) {
|
||||
fiber.flags |= 16384;
|
||||
@@ -16971,7 +16982,7 @@ Internals.Events = [
|
||||
var devToolsConfig$jscomp$inline_1858 = {
|
||||
findFiberByHostInstance: getClosestInstanceFromNode,
|
||||
bundleType: 0,
|
||||
version: "18.3.0-www-classic-e1e0fe51",
|
||||
version: "18.3.0-www-classic-d297891e",
|
||||
rendererPackageName: "react-dom"
|
||||
};
|
||||
var internals$jscomp$inline_2237 = {
|
||||
@@ -17001,7 +17012,7 @@ var internals$jscomp$inline_2237 = {
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "18.3.0-www-classic-e1e0fe51"
|
||||
reconcilerVersion: "18.3.0-www-classic-d297891e"
|
||||
};
|
||||
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
var hook$jscomp$inline_2238 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
@@ -17395,4 +17406,4 @@ exports.unstable_renderSubtreeIntoContainer = function (
|
||||
);
|
||||
};
|
||||
exports.unstable_runWithPriority = runWithPriority;
|
||||
exports.version = "18.3.0-www-classic-e1e0fe51";
|
||||
exports.version = "18.3.0-www-classic-d297891e";
|
||||
|
||||
@@ -3806,16 +3806,20 @@ function updateMutableSource(source, getSnapshot, subscribe) {
|
||||
var hook = updateWorkInProgressHook();
|
||||
return useMutableSource(hook, source, getSnapshot, subscribe);
|
||||
}
|
||||
function updateSyncExternalStore(subscribe, getSnapshot) {
|
||||
function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
var fiber = currentlyRenderingFiber$1,
|
||||
hook = updateWorkInProgressHook(),
|
||||
nextSnapshot = getSnapshot(),
|
||||
snapshotChanged = !objectIs(
|
||||
(currentHook || hook).memoizedState,
|
||||
nextSnapshot
|
||||
);
|
||||
isHydrating$jscomp$0 = isHydrating;
|
||||
if (isHydrating$jscomp$0) {
|
||||
if (void 0 === getServerSnapshot) throw Error(formatProdErrorMessage(407));
|
||||
getServerSnapshot = getServerSnapshot();
|
||||
} else getServerSnapshot = getSnapshot();
|
||||
var snapshotChanged = !objectIs(
|
||||
(currentHook || hook).memoizedState,
|
||||
getServerSnapshot
|
||||
);
|
||||
snapshotChanged &&
|
||||
((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0));
|
||||
((hook.memoizedState = getServerSnapshot), (didReceiveUpdate = !0));
|
||||
hook = hook.queue;
|
||||
updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [
|
||||
subscribe
|
||||
@@ -3828,16 +3832,23 @@ function updateSyncExternalStore(subscribe, getSnapshot) {
|
||||
fiber.flags |= 2048;
|
||||
pushEffect(
|
||||
9,
|
||||
updateStoreInstance.bind(null, fiber, hook, nextSnapshot, getSnapshot),
|
||||
updateStoreInstance.bind(
|
||||
null,
|
||||
fiber,
|
||||
hook,
|
||||
getServerSnapshot,
|
||||
getSnapshot
|
||||
),
|
||||
{ destroy: void 0 },
|
||||
null
|
||||
);
|
||||
subscribe = workInProgressRoot;
|
||||
if (null === subscribe) throw Error(formatProdErrorMessage(349));
|
||||
includesBlockingLane(subscribe, renderLanes$1) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
||||
isHydrating$jscomp$0 ||
|
||||
includesBlockingLane(subscribe, renderLanes$1) ||
|
||||
pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot);
|
||||
}
|
||||
return nextSnapshot;
|
||||
return getServerSnapshot;
|
||||
}
|
||||
function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) {
|
||||
fiber.flags |= 16384;
|
||||
@@ -16553,7 +16564,7 @@ Internals.Events = [
|
||||
var devToolsConfig$jscomp$inline_1817 = {
|
||||
findFiberByHostInstance: getClosestInstanceFromNode,
|
||||
bundleType: 0,
|
||||
version: "18.3.0-www-modern-bc9d666a",
|
||||
version: "18.3.0-www-modern-6995898a",
|
||||
rendererPackageName: "react-dom"
|
||||
};
|
||||
var internals$jscomp$inline_2201 = {
|
||||
@@ -16584,7 +16595,7 @@ var internals$jscomp$inline_2201 = {
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "18.3.0-www-modern-bc9d666a"
|
||||
reconcilerVersion: "18.3.0-www-modern-6995898a"
|
||||
};
|
||||
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
var hook$jscomp$inline_2202 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
@@ -16906,4 +16917,4 @@ exports.unstable_createEventHandle = function (type, options) {
|
||||
return eventHandle;
|
||||
};
|
||||
exports.unstable_runWithPriority = runWithPriority;
|
||||
exports.version = "18.3.0-www-modern-bc9d666a";
|
||||
exports.version = "18.3.0-www-modern-6995898a";
|
||||
|
||||
@@ -8050,8 +8050,6 @@ function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
// clean-up function, and we track the deps correctly, we can call pushEffect
|
||||
// directly, without storing any additional state. For the same reason, we
|
||||
// don't need to set a static flag, either.
|
||||
// TODO: We can move this to the passive phase once we add a pre-commit
|
||||
// consistency check. See the next comment.
|
||||
|
||||
fiber.flags |= Passive$1;
|
||||
pushEffect(
|
||||
@@ -8069,18 +8067,22 @@ function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
// normal rules of React, and only works because store updates are
|
||||
// always synchronous.
|
||||
|
||||
var nextSnapshot = getSnapshot();
|
||||
var nextSnapshot;
|
||||
|
||||
{
|
||||
if (!didWarnUncachedGetSnapshot) {
|
||||
var cachedSnapshot = getSnapshot();
|
||||
nextSnapshot = getSnapshot();
|
||||
|
||||
if (!objectIs(nextSnapshot, cachedSnapshot)) {
|
||||
error(
|
||||
"The result of getSnapshot should be cached to avoid an infinite loop"
|
||||
);
|
||||
{
|
||||
if (!didWarnUncachedGetSnapshot) {
|
||||
var cachedSnapshot = getSnapshot();
|
||||
|
||||
didWarnUncachedGetSnapshot = true;
|
||||
if (!objectIs(nextSnapshot, cachedSnapshot)) {
|
||||
error(
|
||||
"The result of getSnapshot should be cached to avoid an infinite loop"
|
||||
);
|
||||
|
||||
didWarnUncachedGetSnapshot = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8103,7 +8105,7 @@ function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
|
||||
if (
|
||||
inst.getSnapshot !== getSnapshot ||
|
||||
snapshotChanged || // Check if the susbcribe function changed. We can save some memory by
|
||||
snapshotChanged || // Check if the subscribe function changed. We can save some memory by
|
||||
// checking whether we scheduled a subscription effect above.
|
||||
(workInProgressHook !== null &&
|
||||
workInProgressHook.memoizedState.tag & HasEffect)
|
||||
@@ -8310,7 +8312,8 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) {
|
||||
var hook = updateWorkInProgressHook();
|
||||
var nextDeps = deps === undefined ? null : deps;
|
||||
var effect = hook.memoizedState;
|
||||
var inst = effect.inst; // currentHook is null when rerendering after a render phase state update.
|
||||
var inst = effect.inst; // currentHook is null on initial mount when rerendering after a render phase
|
||||
// state update or for strict mode.
|
||||
|
||||
if (currentHook !== null) {
|
||||
if (nextDeps !== null) {
|
||||
@@ -24549,7 +24552,7 @@ function createFiberRoot(
|
||||
return root;
|
||||
}
|
||||
|
||||
var ReactVersion = "18.3.0-www-classic-b4adcaa5";
|
||||
var ReactVersion = "18.3.0-www-classic-2a7e99ed";
|
||||
|
||||
// Might add PROFILE later.
|
||||
|
||||
|
||||
@@ -8050,8 +8050,6 @@ function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
// clean-up function, and we track the deps correctly, we can call pushEffect
|
||||
// directly, without storing any additional state. For the same reason, we
|
||||
// don't need to set a static flag, either.
|
||||
// TODO: We can move this to the passive phase once we add a pre-commit
|
||||
// consistency check. See the next comment.
|
||||
|
||||
fiber.flags |= Passive$1;
|
||||
pushEffect(
|
||||
@@ -8069,18 +8067,22 @@ function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
// normal rules of React, and only works because store updates are
|
||||
// always synchronous.
|
||||
|
||||
var nextSnapshot = getSnapshot();
|
||||
var nextSnapshot;
|
||||
|
||||
{
|
||||
if (!didWarnUncachedGetSnapshot) {
|
||||
var cachedSnapshot = getSnapshot();
|
||||
nextSnapshot = getSnapshot();
|
||||
|
||||
if (!objectIs(nextSnapshot, cachedSnapshot)) {
|
||||
error(
|
||||
"The result of getSnapshot should be cached to avoid an infinite loop"
|
||||
);
|
||||
{
|
||||
if (!didWarnUncachedGetSnapshot) {
|
||||
var cachedSnapshot = getSnapshot();
|
||||
|
||||
didWarnUncachedGetSnapshot = true;
|
||||
if (!objectIs(nextSnapshot, cachedSnapshot)) {
|
||||
error(
|
||||
"The result of getSnapshot should be cached to avoid an infinite loop"
|
||||
);
|
||||
|
||||
didWarnUncachedGetSnapshot = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8103,7 +8105,7 @@ function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
||||
|
||||
if (
|
||||
inst.getSnapshot !== getSnapshot ||
|
||||
snapshotChanged || // Check if the susbcribe function changed. We can save some memory by
|
||||
snapshotChanged || // Check if the subscribe function changed. We can save some memory by
|
||||
// checking whether we scheduled a subscription effect above.
|
||||
(workInProgressHook !== null &&
|
||||
workInProgressHook.memoizedState.tag & HasEffect)
|
||||
@@ -8310,7 +8312,8 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) {
|
||||
var hook = updateWorkInProgressHook();
|
||||
var nextDeps = deps === undefined ? null : deps;
|
||||
var effect = hook.memoizedState;
|
||||
var inst = effect.inst; // currentHook is null when rerendering after a render phase state update.
|
||||
var inst = effect.inst; // currentHook is null on initial mount when rerendering after a render phase
|
||||
// state update or for strict mode.
|
||||
|
||||
if (currentHook !== null) {
|
||||
if (nextDeps !== null) {
|
||||
@@ -24549,7 +24552,7 @@ function createFiberRoot(
|
||||
return root;
|
||||
}
|
||||
|
||||
var ReactVersion = "18.3.0-www-modern-bc9d666a";
|
||||
var ReactVersion = "18.3.0-www-modern-6995898a";
|
||||
|
||||
// Might add PROFILE later.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user