diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index 2d82e62963ef0..14e9272808689 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -7f217d1d88d3b628d97a714ce1573526080af47d +b9af819f8b0e7f14200cfffe04da835b56f2f75d diff --git a/compiled/facebook-www/REVISION_TRANSFORMS b/compiled/facebook-www/REVISION_TRANSFORMS index 2d82e62963ef0..14e9272808689 100644 --- a/compiled/facebook-www/REVISION_TRANSFORMS +++ b/compiled/facebook-www/REVISION_TRANSFORMS @@ -1 +1 @@ -7f217d1d88d3b628d97a714ce1573526080af47d +b9af819f8b0e7f14200cfffe04da835b56f2f75d diff --git a/compiled/facebook-www/React-dev.classic.js b/compiled/facebook-www/React-dev.classic.js index fa18dd29211f7..9be5c653dc733 100644 --- a/compiled/facebook-www/React-dev.classic.js +++ b/compiled/facebook-www/React-dev.classic.js @@ -1200,6 +1200,8 @@ __DEV__ && disableDefaultPropsExceptForClasses = dynamicFeatureFlags.disableDefaultPropsExceptForClasses, enableDebugTracing = dynamicFeatureFlags.enableDebugTracing, + enableLazyContextPropagation = + dynamicFeatureFlags.enableLazyContextPropagation, enableRenderableContext = dynamicFeatureFlags.enableRenderableContext, enableTransitionTracing = dynamicFeatureFlags.enableTransitionTracing, renameElementSymbol = dynamicFeatureFlags.renameElementSymbol, @@ -1921,6 +1923,15 @@ __DEV__ && exports.unstable_useCacheRefresh = function () { return resolveDispatcher().useCacheRefresh(); }; + exports.unstable_useContextWithBailout = function (context, select) { + if (!enableLazyContextPropagation) throw Error("Not implemented."); + var dispatcher = resolveDispatcher(); + context.$$typeof === REACT_CONSUMER_TYPE && + error$jscomp$0( + "Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?" + ); + return dispatcher.unstable_useContextWithBailout(context, select); + }; exports.unstable_useMemoCache = useMemoCache; exports.use = function (usable) { return resolveDispatcher().use(usable); @@ -1993,7 +2004,7 @@ __DEV__ && exports.useTransition = function () { return resolveDispatcher().useTransition(); }; - exports.version = "19.0.0-www-classic-7f217d1d-20240725"; + exports.version = "19.0.0-www-classic-b9af819f-20240726"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled/facebook-www/React-dev.modern.js b/compiled/facebook-www/React-dev.modern.js index 46c7eb9d9f60e..10cfd7dde1d1c 100644 --- a/compiled/facebook-www/React-dev.modern.js +++ b/compiled/facebook-www/React-dev.modern.js @@ -1197,6 +1197,8 @@ __DEV__ && disableDefaultPropsExceptForClasses = dynamicFeatureFlags.disableDefaultPropsExceptForClasses, enableDebugTracing = dynamicFeatureFlags.enableDebugTracing, + enableLazyContextPropagation = + dynamicFeatureFlags.enableLazyContextPropagation, enableRenderableContext = dynamicFeatureFlags.enableRenderableContext, enableTransitionTracing = dynamicFeatureFlags.enableTransitionTracing, renameElementSymbol = dynamicFeatureFlags.renameElementSymbol, @@ -1901,6 +1903,15 @@ __DEV__ && exports.unstable_useCacheRefresh = function () { return resolveDispatcher().useCacheRefresh(); }; + exports.unstable_useContextWithBailout = function (context, select) { + if (!enableLazyContextPropagation) throw Error("Not implemented."); + var dispatcher = resolveDispatcher(); + context.$$typeof === REACT_CONSUMER_TYPE && + error$jscomp$0( + "Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?" + ); + return dispatcher.unstable_useContextWithBailout(context, select); + }; exports.unstable_useMemoCache = useMemoCache; exports.use = function (usable) { return resolveDispatcher().use(usable); @@ -1973,7 +1984,7 @@ __DEV__ && exports.useTransition = function () { return resolveDispatcher().useTransition(); }; - exports.version = "19.0.0-www-modern-7f217d1d-20240725"; + exports.version = "19.0.0-www-modern-b9af819f-20240726"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled/facebook-www/React-prod.classic.js b/compiled/facebook-www/React-prod.classic.js index db71dbdfde8bd..4943555a0dc26 100644 --- a/compiled/facebook-www/React-prod.classic.js +++ b/compiled/facebook-www/React-prod.classic.js @@ -14,6 +14,8 @@ var dynamicFeatureFlags = require("ReactFeatureFlags"), disableDefaultPropsExceptForClasses = dynamicFeatureFlags.disableDefaultPropsExceptForClasses, + enableLazyContextPropagation = + dynamicFeatureFlags.enableLazyContextPropagation, enableRenderableContext = dynamicFeatureFlags.enableRenderableContext, enableTransitionTracing = dynamicFeatureFlags.enableTransitionTracing, renameElementSymbol = dynamicFeatureFlags.renameElementSymbol, @@ -601,6 +603,10 @@ exports.unstable_getCacheForType = function (resourceType) { exports.unstable_useCacheRefresh = function () { return ReactSharedInternals.H.useCacheRefresh(); }; +exports.unstable_useContextWithBailout = function (context, select) { + if (!enableLazyContextPropagation) throw Error("Not implemented."); + return ReactSharedInternals.H.unstable_useContextWithBailout(context, select); +}; exports.unstable_useMemoCache = useMemoCache; exports.use = function (usable) { return ReactSharedInternals.H.use(usable); @@ -662,4 +668,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.0.0-www-classic-7f217d1d-20240725"; +exports.version = "19.0.0-www-classic-b9af819f-20240726"; diff --git a/compiled/facebook-www/React-prod.modern.js b/compiled/facebook-www/React-prod.modern.js index 0ea3713bf8063..74698f2cb046c 100644 --- a/compiled/facebook-www/React-prod.modern.js +++ b/compiled/facebook-www/React-prod.modern.js @@ -14,6 +14,8 @@ var dynamicFeatureFlags = require("ReactFeatureFlags"), disableDefaultPropsExceptForClasses = dynamicFeatureFlags.disableDefaultPropsExceptForClasses, + enableLazyContextPropagation = + dynamicFeatureFlags.enableLazyContextPropagation, enableRenderableContext = dynamicFeatureFlags.enableRenderableContext, enableTransitionTracing = dynamicFeatureFlags.enableTransitionTracing, renameElementSymbol = dynamicFeatureFlags.renameElementSymbol, @@ -601,6 +603,10 @@ exports.unstable_getCacheForType = function (resourceType) { exports.unstable_useCacheRefresh = function () { return ReactSharedInternals.H.useCacheRefresh(); }; +exports.unstable_useContextWithBailout = function (context, select) { + if (!enableLazyContextPropagation) throw Error("Not implemented."); + return ReactSharedInternals.H.unstable_useContextWithBailout(context, select); +}; exports.unstable_useMemoCache = useMemoCache; exports.use = function (usable) { return ReactSharedInternals.H.use(usable); @@ -662,4 +668,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.0.0-www-modern-7f217d1d-20240725"; +exports.version = "19.0.0-www-modern-b9af819f-20240726"; diff --git a/compiled/facebook-www/React-profiling.classic.js b/compiled/facebook-www/React-profiling.classic.js index 35084f7b14609..22592e6b47d0e 100644 --- a/compiled/facebook-www/React-profiling.classic.js +++ b/compiled/facebook-www/React-profiling.classic.js @@ -18,6 +18,8 @@ var dynamicFeatureFlags = require("ReactFeatureFlags"), disableDefaultPropsExceptForClasses = dynamicFeatureFlags.disableDefaultPropsExceptForClasses, + enableLazyContextPropagation = + dynamicFeatureFlags.enableLazyContextPropagation, enableRenderableContext = dynamicFeatureFlags.enableRenderableContext, enableTransitionTracing = dynamicFeatureFlags.enableTransitionTracing, renameElementSymbol = dynamicFeatureFlags.renameElementSymbol, @@ -605,6 +607,10 @@ exports.unstable_getCacheForType = function (resourceType) { exports.unstable_useCacheRefresh = function () { return ReactSharedInternals.H.useCacheRefresh(); }; +exports.unstable_useContextWithBailout = function (context, select) { + if (!enableLazyContextPropagation) throw Error("Not implemented."); + return ReactSharedInternals.H.unstable_useContextWithBailout(context, select); +}; exports.unstable_useMemoCache = useMemoCache; exports.use = function (usable) { return ReactSharedInternals.H.use(usable); @@ -666,7 +672,7 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.0.0-www-classic-7f217d1d-20240725"; +exports.version = "19.0.0-www-classic-b9af819f-20240726"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled/facebook-www/React-profiling.modern.js b/compiled/facebook-www/React-profiling.modern.js index 3e2d7e5741306..5382b2b3d8ce7 100644 --- a/compiled/facebook-www/React-profiling.modern.js +++ b/compiled/facebook-www/React-profiling.modern.js @@ -18,6 +18,8 @@ var dynamicFeatureFlags = require("ReactFeatureFlags"), disableDefaultPropsExceptForClasses = dynamicFeatureFlags.disableDefaultPropsExceptForClasses, + enableLazyContextPropagation = + dynamicFeatureFlags.enableLazyContextPropagation, enableRenderableContext = dynamicFeatureFlags.enableRenderableContext, enableTransitionTracing = dynamicFeatureFlags.enableTransitionTracing, renameElementSymbol = dynamicFeatureFlags.renameElementSymbol, @@ -605,6 +607,10 @@ exports.unstable_getCacheForType = function (resourceType) { exports.unstable_useCacheRefresh = function () { return ReactSharedInternals.H.useCacheRefresh(); }; +exports.unstable_useContextWithBailout = function (context, select) { + if (!enableLazyContextPropagation) throw Error("Not implemented."); + return ReactSharedInternals.H.unstable_useContextWithBailout(context, select); +}; exports.unstable_useMemoCache = useMemoCache; exports.use = function (usable) { return ReactSharedInternals.H.use(usable); @@ -666,7 +672,7 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.0.0-www-modern-7f217d1d-20240725"; +exports.version = "19.0.0-www-modern-b9af819f-20240726"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled/facebook-www/ReactART-dev.classic.js b/compiled/facebook-www/ReactART-dev.classic.js index 95cbdec6a71cf..2f6da99baab6f 100644 --- a/compiled/facebook-www/ReactART-dev.classic.js +++ b/compiled/facebook-www/ReactART-dev.classic.js @@ -4266,6 +4266,32 @@ __DEV__ && } return workInProgressHook; } + function unstable_useContextWithBailout(context, select) { + if (null === select) return readContext(context); + if (!enableLazyContextPropagation) throw Error("Not implemented."); + var consumer = currentlyRenderingFiber, + value = context._currentValue2; + if (lastFullyObservedContext !== context) + if ( + ((context = { + context: context, + memoizedValue: value, + next: null, + select: select, + lastSelectedValue: select(value) + }), + null === lastContextDependency) + ) { + if (null === consumer) + throw Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + enableLazyContextPropagation && (consumer.flags |= 524288); + } else lastContextDependency = lastContextDependency.next = context; + return value; + } function useThenable(thenable) { var index = thenableIndexCounter; thenableIndexCounter += 1; @@ -8751,8 +8777,19 @@ __DEV__ && a: for (; null !== list; ) { var dependency = list; list = fiber; - for (var i = 0; i < contexts.length; i++) + var i = 0; + b: for (; i < contexts.length; i++) if (dependency.context === contexts[i]) { + var select = dependency.select; + if ( + null != select && + null != dependency.lastSelectedValue && + !checkIfSelectedContextValuesChanged( + dependency.lastSelectedValue, + select(dependency.context._currentValue2) + ) + ) + continue b; list.lanes |= renderLanes; dependency = list.alternate; null !== dependency && (dependency.lanes |= renderLanes); @@ -8857,6 +8894,17 @@ __DEV__ && workInProgress.flags |= 262144; } } + function checkIfSelectedContextValuesChanged( + oldComparedValue, + newComparedValue + ) { + if (isArrayImpl(oldComparedValue) && isArrayImpl(newComparedValue)) { + if (oldComparedValue.length !== newComparedValue.length) return !0; + for (var i = 0; i < oldComparedValue.length; i++) + if (!objectIs(newComparedValue[i], oldComparedValue[i])) return !0; + } else throw Error("Compared context values must be arrays"); + return !1; + } function checkIfContextChanged(currentDependencies) { if (!enableLazyContextPropagation) return !1; for ( @@ -8864,13 +8912,20 @@ __DEV__ && null !== currentDependencies; ) { + var newValue = currentDependencies.context._currentValue2, + oldValue = currentDependencies.memoizedValue; if ( - !objectIs( - currentDependencies.context._currentValue2, - currentDependencies.memoizedValue + null != currentDependencies.select && + null != currentDependencies.lastSelectedValue + ) { + if ( + checkIfSelectedContextValuesChanged( + currentDependencies.lastSelectedValue, + currentDependencies.select(newValue) + ) ) - ) - return !0; + return !0; + } else if (!objectIs(newValue, oldValue)) return !0; currentDependencies = currentDependencies.next; } return !1; @@ -15515,6 +15570,8 @@ __DEV__ && ContextOnlyDispatcher.useFormState = throwInvalidHookError; ContextOnlyDispatcher.useActionState = throwInvalidHookError; ContextOnlyDispatcher.useOptimistic = throwInvalidHookError; + ContextOnlyDispatcher.unstable_useContextWithBailout = + throwInvalidHookError; var HooksDispatcherOnMountInDEV = null, HooksDispatcherOnMountWithHookTypesInDEV = null, HooksDispatcherOnUpdateInDEV = null, @@ -15658,6 +15715,14 @@ __DEV__ && mountHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnMountInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + mountHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnMountWithHookTypesInDEV = { readContext: function (context) { return readContext(context); @@ -15795,6 +15860,12 @@ __DEV__ && updateHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnMountWithHookTypesInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnUpdateInDEV = { readContext: function (context) { return readContext(context); @@ -15925,6 +15996,14 @@ __DEV__ && updateHookTypesDev(); return updateOptimistic(passthrough, reducer); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnRerenderInDEV = { readContext: function (context) { return readContext(context); @@ -16055,6 +16134,14 @@ __DEV__ && updateHookTypesDev(); return rerenderOptimistic(passthrough, reducer); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnMountInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -16215,6 +16302,15 @@ __DEV__ && mountHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnUpdateInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -16372,6 +16468,13 @@ __DEV__ && updateHookTypesDev(); return updateOptimistic(passthrough, reducer); }; + InvalidNestedHooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnRerenderInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -16531,6 +16634,13 @@ __DEV__ && updateHookTypesDev(); return rerenderOptimistic(passthrough, reducer); }; + InvalidNestedHooksDispatcherOnRerenderInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; var now = Scheduler.unstable_now, commitTime = 0, layoutEffectStartTime = -1, @@ -17073,14 +17183,14 @@ __DEV__ && scheduleRoot: scheduleRoot, setRefreshHandler: setRefreshHandler, getCurrentFiber: getCurrentFiberForDevTools, - reconcilerVersion: "19.0.0-www-classic-7f217d1d-20240725" + reconcilerVersion: "19.0.0-www-classic-b9af819f-20240726" }); })({ findFiberByHostInstance: function () { return null; }, bundleType: 1, - version: "19.0.0-www-classic-7f217d1d-20240725", + version: "19.0.0-www-classic-b9af819f-20240726", rendererPackageName: "react-art" }); var ClippingRectangle = TYPES.CLIPPING_RECTANGLE, diff --git a/compiled/facebook-www/ReactART-dev.modern.js b/compiled/facebook-www/ReactART-dev.modern.js index c3f68c2743a36..4cb08f1658e27 100644 --- a/compiled/facebook-www/ReactART-dev.modern.js +++ b/compiled/facebook-www/ReactART-dev.modern.js @@ -4156,6 +4156,32 @@ __DEV__ && } return workInProgressHook; } + function unstable_useContextWithBailout(context, select) { + if (null === select) return readContext(context); + if (!enableLazyContextPropagation) throw Error("Not implemented."); + var consumer = currentlyRenderingFiber, + value = context._currentValue2; + if (lastFullyObservedContext !== context) + if ( + ((context = { + context: context, + memoizedValue: value, + next: null, + select: select, + lastSelectedValue: select(value) + }), + null === lastContextDependency) + ) { + if (null === consumer) + throw Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + enableLazyContextPropagation && (consumer.flags |= 524288); + } else lastContextDependency = lastContextDependency.next = context; + return value; + } function useThenable(thenable) { var index = thenableIndexCounter; thenableIndexCounter += 1; @@ -8415,8 +8441,19 @@ __DEV__ && a: for (; null !== list; ) { var dependency = list; list = fiber; - for (var i = 0; i < contexts.length; i++) + var i = 0; + b: for (; i < contexts.length; i++) if (dependency.context === contexts[i]) { + var select = dependency.select; + if ( + null != select && + null != dependency.lastSelectedValue && + !checkIfSelectedContextValuesChanged( + dependency.lastSelectedValue, + select(dependency.context._currentValue2) + ) + ) + continue b; list.lanes |= renderLanes; dependency = list.alternate; null !== dependency && (dependency.lanes |= renderLanes); @@ -8521,6 +8558,17 @@ __DEV__ && workInProgress.flags |= 262144; } } + function checkIfSelectedContextValuesChanged( + oldComparedValue, + newComparedValue + ) { + if (isArrayImpl(oldComparedValue) && isArrayImpl(newComparedValue)) { + if (oldComparedValue.length !== newComparedValue.length) return !0; + for (var i = 0; i < oldComparedValue.length; i++) + if (!objectIs(newComparedValue[i], oldComparedValue[i])) return !0; + } else throw Error("Compared context values must be arrays"); + return !1; + } function checkIfContextChanged(currentDependencies) { if (!enableLazyContextPropagation) return !1; for ( @@ -8528,13 +8576,20 @@ __DEV__ && null !== currentDependencies; ) { + var newValue = currentDependencies.context._currentValue2, + oldValue = currentDependencies.memoizedValue; if ( - !objectIs( - currentDependencies.context._currentValue2, - currentDependencies.memoizedValue + null != currentDependencies.select && + null != currentDependencies.lastSelectedValue + ) { + if ( + checkIfSelectedContextValuesChanged( + currentDependencies.lastSelectedValue, + currentDependencies.select(newValue) + ) ) - ) - return !0; + return !0; + } else if (!objectIs(newValue, oldValue)) return !0; currentDependencies = currentDependencies.next; } return !1; @@ -14925,6 +14980,8 @@ __DEV__ && ContextOnlyDispatcher.useFormState = throwInvalidHookError; ContextOnlyDispatcher.useActionState = throwInvalidHookError; ContextOnlyDispatcher.useOptimistic = throwInvalidHookError; + ContextOnlyDispatcher.unstable_useContextWithBailout = + throwInvalidHookError; var HooksDispatcherOnMountInDEV = null, HooksDispatcherOnMountWithHookTypesInDEV = null, HooksDispatcherOnUpdateInDEV = null, @@ -15068,6 +15125,14 @@ __DEV__ && mountHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnMountInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + mountHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnMountWithHookTypesInDEV = { readContext: function (context) { return readContext(context); @@ -15205,6 +15270,12 @@ __DEV__ && updateHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnMountWithHookTypesInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnUpdateInDEV = { readContext: function (context) { return readContext(context); @@ -15335,6 +15406,14 @@ __DEV__ && updateHookTypesDev(); return updateOptimistic(passthrough, reducer); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnRerenderInDEV = { readContext: function (context) { return readContext(context); @@ -15465,6 +15544,14 @@ __DEV__ && updateHookTypesDev(); return rerenderOptimistic(passthrough, reducer); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnMountInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -15625,6 +15712,15 @@ __DEV__ && mountHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnUpdateInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -15782,6 +15878,13 @@ __DEV__ && updateHookTypesDev(); return updateOptimistic(passthrough, reducer); }; + InvalidNestedHooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnRerenderInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -15941,6 +16044,13 @@ __DEV__ && updateHookTypesDev(); return rerenderOptimistic(passthrough, reducer); }; + InvalidNestedHooksDispatcherOnRerenderInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; var now = Scheduler.unstable_now, commitTime = 0, layoutEffectStartTime = -1, @@ -16481,14 +16591,14 @@ __DEV__ && scheduleRoot: scheduleRoot, setRefreshHandler: setRefreshHandler, getCurrentFiber: getCurrentFiberForDevTools, - reconcilerVersion: "19.0.0-www-modern-7f217d1d-20240725" + reconcilerVersion: "19.0.0-www-modern-b9af819f-20240726" }); })({ findFiberByHostInstance: function () { return null; }, bundleType: 1, - version: "19.0.0-www-modern-7f217d1d-20240725", + version: "19.0.0-www-modern-b9af819f-20240726", rendererPackageName: "react-art" }); var ClippingRectangle = TYPES.CLIPPING_RECTANGLE, diff --git a/compiled/facebook-www/ReactART-prod.classic.js b/compiled/facebook-www/ReactART-prod.classic.js index 3caee4a4be521..c0c651f86cfde 100644 --- a/compiled/facebook-www/ReactART-prod.classic.js +++ b/compiled/facebook-www/ReactART-prod.classic.js @@ -2738,6 +2738,29 @@ function updateWorkInProgressHook() { } return workInProgressHook; } +function unstable_useContextWithBailout(context, select) { + if (null === select) return readContext(context); + if (!enableLazyContextPropagation) throw Error(formatProdErrorMessage(248)); + var consumer = currentlyRenderingFiber, + value = context._currentValue2; + if (lastFullyObservedContext !== context) + if ( + ((context = { + context: context, + memoizedValue: value, + next: null, + select: select, + lastSelectedValue: select(value) + }), + null === lastContextDependency) + ) { + if (null === consumer) throw Error(formatProdErrorMessage(308)); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + enableLazyContextPropagation && (consumer.flags |= 524288); + } else lastContextDependency = lastContextDependency.next = context; + return value; +} var createFunctionComponentUpdateQueue; createFunctionComponentUpdateQueue = function () { return { lastEffect: null, events: null, stores: null, memoCache: null }; @@ -3581,6 +3604,7 @@ ContextOnlyDispatcher.useHostTransitionStatus = throwInvalidHookError; ContextOnlyDispatcher.useFormState = throwInvalidHookError; ContextOnlyDispatcher.useActionState = throwInvalidHookError; ContextOnlyDispatcher.useOptimistic = throwInvalidHookError; +ContextOnlyDispatcher.unstable_useContextWithBailout = throwInvalidHookError; var HooksDispatcherOnMount = { readContext: readContext, use: use, @@ -3743,6 +3767,8 @@ HooksDispatcherOnMount.useOptimistic = function (passthrough) { queue.dispatch = hook; return [passthrough, hook]; }; +HooksDispatcherOnMount.unstable_useContextWithBailout = + unstable_useContextWithBailout; var HooksDispatcherOnUpdate = { readContext: readContext, use: use, @@ -3791,6 +3817,8 @@ HooksDispatcherOnUpdate.useOptimistic = function (passthrough, reducer) { var hook = updateWorkInProgressHook(); return updateOptimisticImpl(hook, currentHook, passthrough, reducer); }; +HooksDispatcherOnUpdate.unstable_useContextWithBailout = + unstable_useContextWithBailout; var HooksDispatcherOnRerender = { readContext: readContext, use: use, @@ -3844,6 +3872,8 @@ HooksDispatcherOnRerender.useOptimistic = function (passthrough, reducer) { hook.baseState = passthrough; return [passthrough, hook.queue.dispatch]; }; +HooksDispatcherOnRerender.unstable_useContextWithBailout = + unstable_useContextWithBailout; function applyDerivedStateFromProps( workInProgress, ctor, @@ -6256,8 +6286,19 @@ function propagateContextChanges( a: for (; null !== list; ) { var dependency = list; list = fiber; - for (var i = 0; i < contexts.length; i++) + var i = 0; + b: for (; i < contexts.length; i++) if (dependency.context === contexts[i]) { + var select = dependency.select; + if ( + null != select && + null != dependency.lastSelectedValue && + !checkIfSelectedContextValuesChanged( + dependency.lastSelectedValue, + select(dependency.context._currentValue2) + ) + ) + continue b; list.lanes |= renderLanes; dependency = list.alternate; null !== dependency && (dependency.lanes |= renderLanes); @@ -6347,6 +6388,17 @@ function propagateParentContextChanges( workInProgress.flags |= 262144; } } +function checkIfSelectedContextValuesChanged( + oldComparedValue, + newComparedValue +) { + if (isArrayImpl(oldComparedValue) && isArrayImpl(newComparedValue)) { + if (oldComparedValue.length !== newComparedValue.length) return !0; + for (var i = 0; i < oldComparedValue.length; i++) + if (!objectIs(newComparedValue[i], oldComparedValue[i])) return !0; + } else throw Error(formatProdErrorMessage(541)); + return !1; +} function checkIfContextChanged(currentDependencies) { if (!enableLazyContextPropagation) return !1; for ( @@ -6354,13 +6406,20 @@ function checkIfContextChanged(currentDependencies) { null !== currentDependencies; ) { + var newValue = currentDependencies.context._currentValue2, + oldValue = currentDependencies.memoizedValue; if ( - !objectIs( - currentDependencies.context._currentValue2, - currentDependencies.memoizedValue + null != currentDependencies.select && + null != currentDependencies.lastSelectedValue + ) { + if ( + checkIfSelectedContextValuesChanged( + currentDependencies.lastSelectedValue, + currentDependencies.select(newValue) + ) ) - ) - return !0; + return !0; + } else if (!objectIs(newValue, oldValue)) return !0; currentDependencies = currentDependencies.next; } return !1; @@ -10756,19 +10815,19 @@ var slice = Array.prototype.slice, }; return Text; })(React.Component), - devToolsConfig$jscomp$inline_1176 = { + devToolsConfig$jscomp$inline_1180 = { findFiberByHostInstance: function () { return null; }, bundleType: 0, - version: "19.0.0-www-classic-7f217d1d-20240725", + version: "19.0.0-www-classic-b9af819f-20240726", rendererPackageName: "react-art" }; -var internals$jscomp$inline_1375 = { - bundleType: devToolsConfig$jscomp$inline_1176.bundleType, - version: devToolsConfig$jscomp$inline_1176.version, - rendererPackageName: devToolsConfig$jscomp$inline_1176.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1176.rendererConfig, +var internals$jscomp$inline_1385 = { + bundleType: devToolsConfig$jscomp$inline_1180.bundleType, + version: devToolsConfig$jscomp$inline_1180.version, + rendererPackageName: devToolsConfig$jscomp$inline_1180.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1180.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -10785,26 +10844,26 @@ var internals$jscomp$inline_1375 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1176.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1180.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-classic-7f217d1d-20240725" + reconcilerVersion: "19.0.0-www-classic-b9af819f-20240726" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1376 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1386 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1376.isDisabled && - hook$jscomp$inline_1376.supportsFiber + !hook$jscomp$inline_1386.isDisabled && + hook$jscomp$inline_1386.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1376.inject( - internals$jscomp$inline_1375 + (rendererID = hook$jscomp$inline_1386.inject( + internals$jscomp$inline_1385 )), - (injectedHook = hook$jscomp$inline_1376); + (injectedHook = hook$jscomp$inline_1386); } catch (err) {} } var Path = Mode$1.Path; diff --git a/compiled/facebook-www/ReactART-prod.modern.js b/compiled/facebook-www/ReactART-prod.modern.js index f684dd273756d..cb205e36b6398 100644 --- a/compiled/facebook-www/ReactART-prod.modern.js +++ b/compiled/facebook-www/ReactART-prod.modern.js @@ -2583,6 +2583,29 @@ function updateWorkInProgressHook() { } return workInProgressHook; } +function unstable_useContextWithBailout(context, select) { + if (null === select) return readContext(context); + if (!enableLazyContextPropagation) throw Error(formatProdErrorMessage(248)); + var consumer = currentlyRenderingFiber, + value = context._currentValue2; + if (lastFullyObservedContext !== context) + if ( + ((context = { + context: context, + memoizedValue: value, + next: null, + select: select, + lastSelectedValue: select(value) + }), + null === lastContextDependency) + ) { + if (null === consumer) throw Error(formatProdErrorMessage(308)); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + enableLazyContextPropagation && (consumer.flags |= 524288); + } else lastContextDependency = lastContextDependency.next = context; + return value; +} var createFunctionComponentUpdateQueue; createFunctionComponentUpdateQueue = function () { return { lastEffect: null, events: null, stores: null, memoCache: null }; @@ -3426,6 +3449,7 @@ ContextOnlyDispatcher.useHostTransitionStatus = throwInvalidHookError; ContextOnlyDispatcher.useFormState = throwInvalidHookError; ContextOnlyDispatcher.useActionState = throwInvalidHookError; ContextOnlyDispatcher.useOptimistic = throwInvalidHookError; +ContextOnlyDispatcher.unstable_useContextWithBailout = throwInvalidHookError; var HooksDispatcherOnMount = { readContext: readContext, use: use, @@ -3588,6 +3612,8 @@ HooksDispatcherOnMount.useOptimistic = function (passthrough) { queue.dispatch = hook; return [passthrough, hook]; }; +HooksDispatcherOnMount.unstable_useContextWithBailout = + unstable_useContextWithBailout; var HooksDispatcherOnUpdate = { readContext: readContext, use: use, @@ -3636,6 +3662,8 @@ HooksDispatcherOnUpdate.useOptimistic = function (passthrough, reducer) { var hook = updateWorkInProgressHook(); return updateOptimisticImpl(hook, currentHook, passthrough, reducer); }; +HooksDispatcherOnUpdate.unstable_useContextWithBailout = + unstable_useContextWithBailout; var HooksDispatcherOnRerender = { readContext: readContext, use: use, @@ -3689,6 +3717,8 @@ HooksDispatcherOnRerender.useOptimistic = function (passthrough, reducer) { hook.baseState = passthrough; return [passthrough, hook.queue.dispatch]; }; +HooksDispatcherOnRerender.unstable_useContextWithBailout = + unstable_useContextWithBailout; function applyDerivedStateFromProps( workInProgress, ctor, @@ -5878,8 +5908,19 @@ function propagateContextChanges( a: for (; null !== list; ) { var dependency = list; list = fiber; - for (var i = 0; i < contexts.length; i++) + var i = 0; + b: for (; i < contexts.length; i++) if (dependency.context === contexts[i]) { + var select = dependency.select; + if ( + null != select && + null != dependency.lastSelectedValue && + !checkIfSelectedContextValuesChanged( + dependency.lastSelectedValue, + select(dependency.context._currentValue2) + ) + ) + continue b; list.lanes |= renderLanes; dependency = list.alternate; null !== dependency && (dependency.lanes |= renderLanes); @@ -5969,6 +6010,17 @@ function propagateParentContextChanges( workInProgress.flags |= 262144; } } +function checkIfSelectedContextValuesChanged( + oldComparedValue, + newComparedValue +) { + if (isArrayImpl(oldComparedValue) && isArrayImpl(newComparedValue)) { + if (oldComparedValue.length !== newComparedValue.length) return !0; + for (var i = 0; i < oldComparedValue.length; i++) + if (!objectIs(newComparedValue[i], oldComparedValue[i])) return !0; + } else throw Error(formatProdErrorMessage(541)); + return !1; +} function checkIfContextChanged(currentDependencies) { if (!enableLazyContextPropagation) return !1; for ( @@ -5976,13 +6028,20 @@ function checkIfContextChanged(currentDependencies) { null !== currentDependencies; ) { + var newValue = currentDependencies.context._currentValue2, + oldValue = currentDependencies.memoizedValue; if ( - !objectIs( - currentDependencies.context._currentValue2, - currentDependencies.memoizedValue + null != currentDependencies.select && + null != currentDependencies.lastSelectedValue + ) { + if ( + checkIfSelectedContextValuesChanged( + currentDependencies.lastSelectedValue, + currentDependencies.select(newValue) + ) ) - ) - return !0; + return !0; + } else if (!objectIs(newValue, oldValue)) return !0; currentDependencies = currentDependencies.next; } return !1; @@ -10259,19 +10318,19 @@ var slice = Array.prototype.slice, }; return Text; })(React.Component), - devToolsConfig$jscomp$inline_1140 = { + devToolsConfig$jscomp$inline_1144 = { findFiberByHostInstance: function () { return null; }, bundleType: 0, - version: "19.0.0-www-modern-7f217d1d-20240725", + version: "19.0.0-www-modern-b9af819f-20240726", rendererPackageName: "react-art" }; -var internals$jscomp$inline_1361 = { - bundleType: devToolsConfig$jscomp$inline_1140.bundleType, - version: devToolsConfig$jscomp$inline_1140.version, - rendererPackageName: devToolsConfig$jscomp$inline_1140.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1140.rendererConfig, +var internals$jscomp$inline_1371 = { + bundleType: devToolsConfig$jscomp$inline_1144.bundleType, + version: devToolsConfig$jscomp$inline_1144.version, + rendererPackageName: devToolsConfig$jscomp$inline_1144.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1144.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -10288,26 +10347,26 @@ var internals$jscomp$inline_1361 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1140.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1144.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-modern-7f217d1d-20240725" + reconcilerVersion: "19.0.0-www-modern-b9af819f-20240726" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1362 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1372 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1362.isDisabled && - hook$jscomp$inline_1362.supportsFiber + !hook$jscomp$inline_1372.isDisabled && + hook$jscomp$inline_1372.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1362.inject( - internals$jscomp$inline_1361 + (rendererID = hook$jscomp$inline_1372.inject( + internals$jscomp$inline_1371 )), - (injectedHook = hook$jscomp$inline_1362); + (injectedHook = hook$jscomp$inline_1372); } catch (err) {} } var Path = Mode$1.Path; diff --git a/compiled/facebook-www/ReactDOM-dev.classic.js b/compiled/facebook-www/ReactDOM-dev.classic.js index be40e44497943..4a3df42de354d 100644 --- a/compiled/facebook-www/ReactDOM-dev.classic.js +++ b/compiled/facebook-www/ReactDOM-dev.classic.js @@ -5973,6 +5973,32 @@ __DEV__ && } return workInProgressHook; } + function unstable_useContextWithBailout(context, select) { + if (null === select) return readContext(context); + if (!enableLazyContextPropagation) throw Error("Not implemented."); + var consumer = currentlyRenderingFiber, + value = context._currentValue; + if (lastFullyObservedContext !== context) + if ( + ((context = { + context: context, + memoizedValue: value, + next: null, + select: select, + lastSelectedValue: select(value) + }), + null === lastContextDependency) + ) { + if (null === consumer) + throw Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + enableLazyContextPropagation && (consumer.flags |= 524288); + } else lastContextDependency = lastContextDependency.next = context; + return value; + } function useThenable(thenable) { var index = thenableIndexCounter; thenableIndexCounter += 1; @@ -9172,32 +9198,32 @@ __DEV__ && return current; } function updateSuspenseComponent(current, workInProgress, renderLanes) { - var JSCompiler_object_inline_digest_2440; - var JSCompiler_object_inline_stack_2441 = workInProgress.pendingProps; + var JSCompiler_object_inline_digest_2450; + var JSCompiler_object_inline_stack_2451 = workInProgress.pendingProps; shouldSuspendImpl(workInProgress) && (workInProgress.flags |= 128); - var JSCompiler_object_inline_componentStack_2442 = !1; + var JSCompiler_object_inline_componentStack_2452 = !1; var didSuspend = 0 !== (workInProgress.flags & 128); - (JSCompiler_object_inline_digest_2440 = didSuspend) || - (JSCompiler_object_inline_digest_2440 = + (JSCompiler_object_inline_digest_2450 = didSuspend) || + (JSCompiler_object_inline_digest_2450 = null !== current && null === current.memoizedState ? !1 : 0 !== (suspenseStackCursor.current & ForceSuspenseFallback)); - JSCompiler_object_inline_digest_2440 && - ((JSCompiler_object_inline_componentStack_2442 = !0), + JSCompiler_object_inline_digest_2450 && + ((JSCompiler_object_inline_componentStack_2452 = !0), (workInProgress.flags &= -129)); - JSCompiler_object_inline_digest_2440 = 0 !== (workInProgress.flags & 32); + JSCompiler_object_inline_digest_2450 = 0 !== (workInProgress.flags & 32); workInProgress.flags &= -33; if (null === current) { if (isHydrating) { - JSCompiler_object_inline_componentStack_2442 + JSCompiler_object_inline_componentStack_2452 ? pushPrimaryTreeSuspenseHandler(workInProgress) : reuseSuspenseHandlerOnStack(workInProgress); if (isHydrating) { - var JSCompiler_object_inline_message_2439 = nextHydratableInstance; + var JSCompiler_object_inline_message_2449 = nextHydratableInstance; var JSCompiler_temp; - if (!(JSCompiler_temp = !JSCompiler_object_inline_message_2439)) { + if (!(JSCompiler_temp = !JSCompiler_object_inline_message_2449)) { c: { - var instance = JSCompiler_object_inline_message_2439; + var instance = JSCompiler_object_inline_message_2449; for ( JSCompiler_temp = rootOrSingletonContext; instance.nodeType !== COMMENT_NODE; @@ -9238,19 +9264,19 @@ __DEV__ && JSCompiler_temp && (warnNonHydratedInstance( workInProgress, - JSCompiler_object_inline_message_2439 + JSCompiler_object_inline_message_2449 ), throwOnHydrationMismatch(workInProgress)); } - JSCompiler_object_inline_message_2439 = workInProgress.memoizedState; + JSCompiler_object_inline_message_2449 = workInProgress.memoizedState; if ( - null !== JSCompiler_object_inline_message_2439 && - ((JSCompiler_object_inline_message_2439 = - JSCompiler_object_inline_message_2439.dehydrated), - null !== JSCompiler_object_inline_message_2439) + null !== JSCompiler_object_inline_message_2449 && + ((JSCompiler_object_inline_message_2449 = + JSCompiler_object_inline_message_2449.dehydrated), + null !== JSCompiler_object_inline_message_2449) ) return ( - JSCompiler_object_inline_message_2439.data === + JSCompiler_object_inline_message_2449.data === SUSPENSE_FALLBACK_START_DATA ? (workInProgress.lanes = DefaultHydrationLane) : (workInProgress.lanes = OffscreenLane), @@ -9258,27 +9284,27 @@ __DEV__ && ); popSuspenseHandler(workInProgress); } - JSCompiler_object_inline_message_2439 = - JSCompiler_object_inline_stack_2441.children; - JSCompiler_temp = JSCompiler_object_inline_stack_2441.fallback; - if (JSCompiler_object_inline_componentStack_2442) + JSCompiler_object_inline_message_2449 = + JSCompiler_object_inline_stack_2451.children; + JSCompiler_temp = JSCompiler_object_inline_stack_2451.fallback; + if (JSCompiler_object_inline_componentStack_2452) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_stack_2441 = + (JSCompiler_object_inline_stack_2451 = mountSuspenseFallbackChildren( workInProgress, - JSCompiler_object_inline_message_2439, + JSCompiler_object_inline_message_2449, JSCompiler_temp, renderLanes )), - (JSCompiler_object_inline_componentStack_2442 = + (JSCompiler_object_inline_componentStack_2452 = workInProgress.child), - (JSCompiler_object_inline_componentStack_2442.memoizedState = + (JSCompiler_object_inline_componentStack_2452.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_componentStack_2442.childLanes = + (JSCompiler_object_inline_componentStack_2452.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2440, + JSCompiler_object_inline_digest_2450, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), @@ -9291,9 +9317,9 @@ __DEV__ && ? markerInstanceStack.current : null), (current = - JSCompiler_object_inline_componentStack_2442.updateQueue), + JSCompiler_object_inline_componentStack_2452.updateQueue), null === current - ? (JSCompiler_object_inline_componentStack_2442.updateQueue = + ? (JSCompiler_object_inline_componentStack_2452.updateQueue = { transitions: workInProgress, markerInstances: renderLanes, @@ -9301,46 +9327,46 @@ __DEV__ && }) : ((current.transitions = workInProgress), (current.markerInstances = renderLanes)))), - JSCompiler_object_inline_stack_2441 + JSCompiler_object_inline_stack_2451 ); if ( "number" === - typeof JSCompiler_object_inline_stack_2441.unstable_expectedLoadTime + typeof JSCompiler_object_inline_stack_2451.unstable_expectedLoadTime ) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_stack_2441 = + (JSCompiler_object_inline_stack_2451 = mountSuspenseFallbackChildren( workInProgress, - JSCompiler_object_inline_message_2439, + JSCompiler_object_inline_message_2449, JSCompiler_temp, renderLanes )), - (JSCompiler_object_inline_componentStack_2442 = + (JSCompiler_object_inline_componentStack_2452 = workInProgress.child), - (JSCompiler_object_inline_componentStack_2442.memoizedState = + (JSCompiler_object_inline_componentStack_2452.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_componentStack_2442.childLanes = + (JSCompiler_object_inline_componentStack_2452.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2440, + JSCompiler_object_inline_digest_2450, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress.lanes = 4194304), - JSCompiler_object_inline_stack_2441 + JSCompiler_object_inline_stack_2451 ); pushPrimaryTreeSuspenseHandler(workInProgress); return mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_message_2439 + JSCompiler_object_inline_message_2449 ); } var prevState = current.memoizedState; if ( null !== prevState && - ((JSCompiler_object_inline_message_2439 = prevState.dehydrated), - null !== JSCompiler_object_inline_message_2439) + ((JSCompiler_object_inline_message_2449 = prevState.dehydrated), + null !== JSCompiler_object_inline_message_2449) ) { if (didSuspend) workInProgress.flags & 256 @@ -9357,32 +9383,32 @@ __DEV__ && (workInProgress.flags |= 128), (workInProgress = null)) : (reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_componentStack_2442 = - JSCompiler_object_inline_stack_2441.fallback), - (JSCompiler_object_inline_message_2439 = workInProgress.mode), - (JSCompiler_object_inline_stack_2441 = createFiberFromOffscreen( + (JSCompiler_object_inline_componentStack_2452 = + JSCompiler_object_inline_stack_2451.fallback), + (JSCompiler_object_inline_message_2449 = workInProgress.mode), + (JSCompiler_object_inline_stack_2451 = createFiberFromOffscreen( { mode: "visible", - children: JSCompiler_object_inline_stack_2441.children + children: JSCompiler_object_inline_stack_2451.children }, - JSCompiler_object_inline_message_2439, + JSCompiler_object_inline_message_2449, 0, null )), - (JSCompiler_object_inline_componentStack_2442 = + (JSCompiler_object_inline_componentStack_2452 = createFiberFromFragment( - JSCompiler_object_inline_componentStack_2442, - JSCompiler_object_inline_message_2439, + JSCompiler_object_inline_componentStack_2452, + JSCompiler_object_inline_message_2449, renderLanes, null )), - (JSCompiler_object_inline_componentStack_2442.flags |= 2), - (JSCompiler_object_inline_stack_2441.return = workInProgress), - (JSCompiler_object_inline_componentStack_2442.return = + (JSCompiler_object_inline_componentStack_2452.flags |= 2), + (JSCompiler_object_inline_stack_2451.return = workInProgress), + (JSCompiler_object_inline_componentStack_2452.return = workInProgress), - (JSCompiler_object_inline_stack_2441.sibling = - JSCompiler_object_inline_componentStack_2442), - (workInProgress.child = JSCompiler_object_inline_stack_2441), + (JSCompiler_object_inline_stack_2451.sibling = + JSCompiler_object_inline_componentStack_2452), + (workInProgress.child = JSCompiler_object_inline_stack_2451), (disableLegacyMode || (workInProgress.mode & ConcurrentMode) !== NoMode) && reconcileChildFibers( @@ -9391,63 +9417,63 @@ __DEV__ && null, renderLanes ), - (JSCompiler_object_inline_stack_2441 = workInProgress.child), - (JSCompiler_object_inline_stack_2441.memoizedState = + (JSCompiler_object_inline_stack_2451 = workInProgress.child), + (JSCompiler_object_inline_stack_2451.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_stack_2441.childLanes = + (JSCompiler_object_inline_stack_2451.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2440, + JSCompiler_object_inline_digest_2450, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress = - JSCompiler_object_inline_componentStack_2442)); + JSCompiler_object_inline_componentStack_2452)); else if ( (pushPrimaryTreeSuspenseHandler(workInProgress), isHydrating && error$jscomp$0( "We should not be hydrating here. This is a bug in React. Please file a bug." ), - JSCompiler_object_inline_message_2439.data === + JSCompiler_object_inline_message_2449.data === SUSPENSE_FALLBACK_START_DATA) ) { - JSCompiler_object_inline_digest_2440 = - JSCompiler_object_inline_message_2439.nextSibling && - JSCompiler_object_inline_message_2439.nextSibling.dataset; - if (JSCompiler_object_inline_digest_2440) { - JSCompiler_temp = JSCompiler_object_inline_digest_2440.dgst; - var message = JSCompiler_object_inline_digest_2440.msg; - instance = JSCompiler_object_inline_digest_2440.stck; - var componentStack = JSCompiler_object_inline_digest_2440.cstck; + JSCompiler_object_inline_digest_2450 = + JSCompiler_object_inline_message_2449.nextSibling && + JSCompiler_object_inline_message_2449.nextSibling.dataset; + if (JSCompiler_object_inline_digest_2450) { + JSCompiler_temp = JSCompiler_object_inline_digest_2450.dgst; + var message = JSCompiler_object_inline_digest_2450.msg; + instance = JSCompiler_object_inline_digest_2450.stck; + var componentStack = JSCompiler_object_inline_digest_2450.cstck; } - JSCompiler_object_inline_message_2439 = message; - JSCompiler_object_inline_digest_2440 = JSCompiler_temp; - JSCompiler_object_inline_stack_2441 = instance; - JSCompiler_object_inline_componentStack_2442 = componentStack; - JSCompiler_object_inline_message_2439 = - JSCompiler_object_inline_message_2439 - ? Error(JSCompiler_object_inline_message_2439) + JSCompiler_object_inline_message_2449 = message; + JSCompiler_object_inline_digest_2450 = JSCompiler_temp; + JSCompiler_object_inline_stack_2451 = instance; + JSCompiler_object_inline_componentStack_2452 = componentStack; + JSCompiler_object_inline_message_2449 = + JSCompiler_object_inline_message_2449 + ? Error(JSCompiler_object_inline_message_2449) : Error( "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." ); - JSCompiler_object_inline_message_2439.stack = - JSCompiler_object_inline_stack_2441 || ""; - JSCompiler_object_inline_message_2439.digest = - JSCompiler_object_inline_digest_2440; - JSCompiler_object_inline_digest_2440 = - void 0 === JSCompiler_object_inline_componentStack_2442 + JSCompiler_object_inline_message_2449.stack = + JSCompiler_object_inline_stack_2451 || ""; + JSCompiler_object_inline_message_2449.digest = + JSCompiler_object_inline_digest_2450; + JSCompiler_object_inline_digest_2450 = + void 0 === JSCompiler_object_inline_componentStack_2452 ? null - : JSCompiler_object_inline_componentStack_2442; - "string" === typeof JSCompiler_object_inline_digest_2440 && + : JSCompiler_object_inline_componentStack_2452; + "string" === typeof JSCompiler_object_inline_digest_2450 && CapturedStacks.set( - JSCompiler_object_inline_message_2439, - JSCompiler_object_inline_digest_2440 + JSCompiler_object_inline_message_2449, + JSCompiler_object_inline_digest_2450 ); queueHydrationError({ - value: JSCompiler_object_inline_message_2439, + value: JSCompiler_object_inline_message_2449, source: null, - stack: JSCompiler_object_inline_digest_2440 + stack: JSCompiler_object_inline_digest_2450 }); workInProgress = retrySuspenseComponentWithoutHydrating( current, @@ -9463,26 +9489,26 @@ __DEV__ && renderLanes, !1 ), - (JSCompiler_object_inline_digest_2440 = + (JSCompiler_object_inline_digest_2450 = 0 !== (renderLanes & current.childLanes)), - didReceiveUpdate || JSCompiler_object_inline_digest_2440) + didReceiveUpdate || JSCompiler_object_inline_digest_2450) ) { - JSCompiler_object_inline_digest_2440 = workInProgressRoot; - if (null !== JSCompiler_object_inline_digest_2440) { - JSCompiler_object_inline_stack_2441 = renderLanes & -renderLanes; - if (0 !== (JSCompiler_object_inline_stack_2441 & SyncUpdateLanes)) - JSCompiler_object_inline_stack_2441 = SyncHydrationLane; + JSCompiler_object_inline_digest_2450 = workInProgressRoot; + if (null !== JSCompiler_object_inline_digest_2450) { + JSCompiler_object_inline_stack_2451 = renderLanes & -renderLanes; + if (0 !== (JSCompiler_object_inline_stack_2451 & SyncUpdateLanes)) + JSCompiler_object_inline_stack_2451 = SyncHydrationLane; else - switch (JSCompiler_object_inline_stack_2441) { + switch (JSCompiler_object_inline_stack_2451) { case SyncLane: - JSCompiler_object_inline_stack_2441 = SyncHydrationLane; + JSCompiler_object_inline_stack_2451 = SyncHydrationLane; break; case InputContinuousLane: - JSCompiler_object_inline_stack_2441 = + JSCompiler_object_inline_stack_2451 = InputContinuousHydrationLane; break; case DefaultLane: - JSCompiler_object_inline_stack_2441 = DefaultHydrationLane; + JSCompiler_object_inline_stack_2451 = DefaultHydrationLane; break; case 128: case 256: @@ -9503,40 +9529,40 @@ __DEV__ && case 8388608: case 16777216: case 33554432: - JSCompiler_object_inline_stack_2441 = TransitionHydrationLane; + JSCompiler_object_inline_stack_2451 = TransitionHydrationLane; break; case IdleLane: - JSCompiler_object_inline_stack_2441 = IdleHydrationLane; + JSCompiler_object_inline_stack_2451 = IdleHydrationLane; break; default: - JSCompiler_object_inline_stack_2441 = 0; + JSCompiler_object_inline_stack_2451 = 0; } - JSCompiler_object_inline_stack_2441 = + JSCompiler_object_inline_stack_2451 = 0 !== - (JSCompiler_object_inline_stack_2441 & - (JSCompiler_object_inline_digest_2440.suspendedLanes | + (JSCompiler_object_inline_stack_2451 & + (JSCompiler_object_inline_digest_2450.suspendedLanes | renderLanes)) ? 0 - : JSCompiler_object_inline_stack_2441; + : JSCompiler_object_inline_stack_2451; if ( - 0 !== JSCompiler_object_inline_stack_2441 && - JSCompiler_object_inline_stack_2441 !== prevState.retryLane + 0 !== JSCompiler_object_inline_stack_2451 && + JSCompiler_object_inline_stack_2451 !== prevState.retryLane ) throw ( - ((prevState.retryLane = JSCompiler_object_inline_stack_2441), + ((prevState.retryLane = JSCompiler_object_inline_stack_2451), enqueueConcurrentRenderForLane( current, - JSCompiler_object_inline_stack_2441 + JSCompiler_object_inline_stack_2451 ), scheduleUpdateOnFiber( - JSCompiler_object_inline_digest_2440, + JSCompiler_object_inline_digest_2450, current, - JSCompiler_object_inline_stack_2441 + JSCompiler_object_inline_stack_2451 ), SelectiveHydrationException) ); } - JSCompiler_object_inline_message_2439.data === + JSCompiler_object_inline_message_2449.data === SUSPENSE_PENDING_START_DATA || renderDidSuspendDelayIfPossible(); workInProgress = retrySuspenseComponentWithoutHydrating( current, @@ -9544,7 +9570,7 @@ __DEV__ && renderLanes ); } else - JSCompiler_object_inline_message_2439.data === + JSCompiler_object_inline_message_2449.data === SUSPENSE_PENDING_START_DATA ? ((workInProgress.flags |= 128), (workInProgress.child = current.child), @@ -9552,12 +9578,12 @@ __DEV__ && null, current )), - (JSCompiler_object_inline_message_2439._reactRetry = + (JSCompiler_object_inline_message_2449._reactRetry = workInProgress), (workInProgress = null)) : ((renderLanes = prevState.treeContext), (nextHydratableInstance = getNextHydratable( - JSCompiler_object_inline_message_2439.nextSibling + JSCompiler_object_inline_message_2449.nextSibling )), (hydrationParentFiber = workInProgress), (isHydrating = !0), @@ -9575,73 +9601,73 @@ __DEV__ && (treeContextProvider = workInProgress)), (workInProgress = mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_stack_2441.children + JSCompiler_object_inline_stack_2451.children )), (workInProgress.flags |= 4096)); return workInProgress; } - if (JSCompiler_object_inline_componentStack_2442) + if (JSCompiler_object_inline_componentStack_2452) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_componentStack_2442 = - JSCompiler_object_inline_stack_2441.fallback), - (JSCompiler_object_inline_message_2439 = workInProgress.mode), + (JSCompiler_object_inline_componentStack_2452 = + JSCompiler_object_inline_stack_2451.fallback), + (JSCompiler_object_inline_message_2449 = workInProgress.mode), (JSCompiler_temp = current.child), (instance = JSCompiler_temp.sibling), (componentStack = { mode: "hidden", - children: JSCompiler_object_inline_stack_2441.children + children: JSCompiler_object_inline_stack_2451.children }), disableLegacyMode || - (JSCompiler_object_inline_message_2439 & ConcurrentMode) !== NoMode || + (JSCompiler_object_inline_message_2449 & ConcurrentMode) !== NoMode || workInProgress.child === JSCompiler_temp - ? ((JSCompiler_object_inline_stack_2441 = createWorkInProgress( + ? ((JSCompiler_object_inline_stack_2451 = createWorkInProgress( JSCompiler_temp, componentStack )), - (JSCompiler_object_inline_stack_2441.subtreeFlags = + (JSCompiler_object_inline_stack_2451.subtreeFlags = JSCompiler_temp.subtreeFlags & 31457280)) - : ((JSCompiler_object_inline_stack_2441 = workInProgress.child), - (JSCompiler_object_inline_stack_2441.childLanes = 0), - (JSCompiler_object_inline_stack_2441.pendingProps = + : ((JSCompiler_object_inline_stack_2451 = workInProgress.child), + (JSCompiler_object_inline_stack_2451.childLanes = 0), + (JSCompiler_object_inline_stack_2451.pendingProps = componentStack), workInProgress.mode & ProfileMode && - ((JSCompiler_object_inline_stack_2441.actualDuration = 0), - (JSCompiler_object_inline_stack_2441.actualStartTime = -1), - (JSCompiler_object_inline_stack_2441.selfBaseDuration = + ((JSCompiler_object_inline_stack_2451.actualDuration = 0), + (JSCompiler_object_inline_stack_2451.actualStartTime = -1), + (JSCompiler_object_inline_stack_2451.selfBaseDuration = JSCompiler_temp.selfBaseDuration), - (JSCompiler_object_inline_stack_2441.treeBaseDuration = + (JSCompiler_object_inline_stack_2451.treeBaseDuration = JSCompiler_temp.treeBaseDuration)), (workInProgress.deletions = null)), null !== instance - ? (JSCompiler_object_inline_componentStack_2442 = + ? (JSCompiler_object_inline_componentStack_2452 = createWorkInProgress( instance, - JSCompiler_object_inline_componentStack_2442 + JSCompiler_object_inline_componentStack_2452 )) - : ((JSCompiler_object_inline_componentStack_2442 = + : ((JSCompiler_object_inline_componentStack_2452 = createFiberFromFragment( - JSCompiler_object_inline_componentStack_2442, - JSCompiler_object_inline_message_2439, + JSCompiler_object_inline_componentStack_2452, + JSCompiler_object_inline_message_2449, renderLanes, null )), - (JSCompiler_object_inline_componentStack_2442.flags |= 2)), - (JSCompiler_object_inline_componentStack_2442.return = + (JSCompiler_object_inline_componentStack_2452.flags |= 2)), + (JSCompiler_object_inline_componentStack_2452.return = workInProgress), - (JSCompiler_object_inline_stack_2441.return = workInProgress), - (JSCompiler_object_inline_stack_2441.sibling = - JSCompiler_object_inline_componentStack_2442), - (workInProgress.child = JSCompiler_object_inline_stack_2441), - (JSCompiler_object_inline_stack_2441 = - JSCompiler_object_inline_componentStack_2442), - (JSCompiler_object_inline_componentStack_2442 = workInProgress.child), - (JSCompiler_object_inline_message_2439 = current.child.memoizedState), - null === JSCompiler_object_inline_message_2439 - ? (JSCompiler_object_inline_message_2439 = + (JSCompiler_object_inline_stack_2451.return = workInProgress), + (JSCompiler_object_inline_stack_2451.sibling = + JSCompiler_object_inline_componentStack_2452), + (workInProgress.child = JSCompiler_object_inline_stack_2451), + (JSCompiler_object_inline_stack_2451 = + JSCompiler_object_inline_componentStack_2452), + (JSCompiler_object_inline_componentStack_2452 = workInProgress.child), + (JSCompiler_object_inline_message_2449 = current.child.memoizedState), + null === JSCompiler_object_inline_message_2449 + ? (JSCompiler_object_inline_message_2449 = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = - JSCompiler_object_inline_message_2439.cachePool), + JSCompiler_object_inline_message_2449.cachePool), null !== JSCompiler_temp ? ((instance = CacheContext._currentValue), (JSCompiler_temp = @@ -9649,34 +9675,34 @@ __DEV__ && ? { parent: instance, pool: instance } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), - (JSCompiler_object_inline_message_2439 = { + (JSCompiler_object_inline_message_2449 = { baseLanes: - JSCompiler_object_inline_message_2439.baseLanes | renderLanes, + JSCompiler_object_inline_message_2449.baseLanes | renderLanes, cachePool: JSCompiler_temp })), - (JSCompiler_object_inline_componentStack_2442.memoizedState = - JSCompiler_object_inline_message_2439), + (JSCompiler_object_inline_componentStack_2452.memoizedState = + JSCompiler_object_inline_message_2449), enableTransitionTracing && - ((JSCompiler_object_inline_message_2439 = enableTransitionTracing + ((JSCompiler_object_inline_message_2449 = enableTransitionTracing ? transitionStack.current : null), - null !== JSCompiler_object_inline_message_2439 && + null !== JSCompiler_object_inline_message_2449 && ((JSCompiler_temp = enableTransitionTracing ? markerInstanceStack.current : null), (instance = - JSCompiler_object_inline_componentStack_2442.updateQueue), + JSCompiler_object_inline_componentStack_2452.updateQueue), (componentStack = current.updateQueue), null === instance - ? (JSCompiler_object_inline_componentStack_2442.updateQueue = { - transitions: JSCompiler_object_inline_message_2439, + ? (JSCompiler_object_inline_componentStack_2452.updateQueue = { + transitions: JSCompiler_object_inline_message_2449, markerInstances: JSCompiler_temp, retryQueue: null }) : instance === componentStack - ? (JSCompiler_object_inline_componentStack_2442.updateQueue = + ? (JSCompiler_object_inline_componentStack_2452.updateQueue = { - transitions: JSCompiler_object_inline_message_2439, + transitions: JSCompiler_object_inline_message_2449, markerInstances: JSCompiler_temp, retryQueue: null !== componentStack @@ -9684,41 +9710,41 @@ __DEV__ && : null }) : ((instance.transitions = - JSCompiler_object_inline_message_2439), + JSCompiler_object_inline_message_2449), (instance.markerInstances = JSCompiler_temp)))), - (JSCompiler_object_inline_componentStack_2442.childLanes = + (JSCompiler_object_inline_componentStack_2452.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2440, + JSCompiler_object_inline_digest_2450, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2441 + JSCompiler_object_inline_stack_2451 ); pushPrimaryTreeSuspenseHandler(workInProgress); - JSCompiler_object_inline_digest_2440 = current.child; - current = JSCompiler_object_inline_digest_2440.sibling; - JSCompiler_object_inline_digest_2440 = createWorkInProgress( - JSCompiler_object_inline_digest_2440, + JSCompiler_object_inline_digest_2450 = current.child; + current = JSCompiler_object_inline_digest_2450.sibling; + JSCompiler_object_inline_digest_2450 = createWorkInProgress( + JSCompiler_object_inline_digest_2450, { mode: "visible", - children: JSCompiler_object_inline_stack_2441.children + children: JSCompiler_object_inline_stack_2451.children } ); disableLegacyMode || (workInProgress.mode & ConcurrentMode) !== NoMode || - (JSCompiler_object_inline_digest_2440.lanes = renderLanes); - JSCompiler_object_inline_digest_2440.return = workInProgress; - JSCompiler_object_inline_digest_2440.sibling = null; + (JSCompiler_object_inline_digest_2450.lanes = renderLanes); + JSCompiler_object_inline_digest_2450.return = workInProgress; + JSCompiler_object_inline_digest_2450.sibling = null; null !== current && ((renderLanes = workInProgress.deletions), null === renderLanes ? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16)) : renderLanes.push(current)); - workInProgress.child = JSCompiler_object_inline_digest_2440; + workInProgress.child = JSCompiler_object_inline_digest_2450; workInProgress.memoizedState = null; - return JSCompiler_object_inline_digest_2440; + return JSCompiler_object_inline_digest_2450; } function mountSuspensePrimaryChildren(workInProgress, primaryChildren) { primaryChildren = createFiberFromOffscreen( @@ -11148,8 +11174,19 @@ __DEV__ && a: for (; null !== list; ) { var dependency = list; list = fiber; - for (var i = 0; i < contexts.length; i++) + var i = 0; + b: for (; i < contexts.length; i++) if (dependency.context === contexts[i]) { + var select = dependency.select; + if ( + null != select && + null != dependency.lastSelectedValue && + !checkIfSelectedContextValuesChanged( + dependency.lastSelectedValue, + select(dependency.context._currentValue) + ) + ) + continue b; list.lanes |= renderLanes; dependency = list.alternate; null !== dependency && (dependency.lanes |= renderLanes); @@ -11254,6 +11291,17 @@ __DEV__ && workInProgress.flags |= 262144; } } + function checkIfSelectedContextValuesChanged( + oldComparedValue, + newComparedValue + ) { + if (isArrayImpl(oldComparedValue) && isArrayImpl(newComparedValue)) { + if (oldComparedValue.length !== newComparedValue.length) return !0; + for (var i = 0; i < oldComparedValue.length; i++) + if (!objectIs(newComparedValue[i], oldComparedValue[i])) return !0; + } else throw Error("Compared context values must be arrays"); + return !1; + } function checkIfContextChanged(currentDependencies) { if (!enableLazyContextPropagation) return !1; for ( @@ -11261,13 +11309,20 @@ __DEV__ && null !== currentDependencies; ) { + var newValue = currentDependencies.context._currentValue, + oldValue = currentDependencies.memoizedValue; if ( - !objectIs( - currentDependencies.context._currentValue, - currentDependencies.memoizedValue + null != currentDependencies.select && + null != currentDependencies.lastSelectedValue + ) { + if ( + checkIfSelectedContextValuesChanged( + currentDependencies.lastSelectedValue, + currentDependencies.select(newValue) + ) ) - ) - return !0; + return !0; + } else if (!objectIs(newValue, oldValue)) return !0; currentDependencies = currentDependencies.next; } return !1; @@ -25510,6 +25565,8 @@ __DEV__ && ContextOnlyDispatcher.useFormState = throwInvalidHookError; ContextOnlyDispatcher.useActionState = throwInvalidHookError; ContextOnlyDispatcher.useOptimistic = throwInvalidHookError; + ContextOnlyDispatcher.unstable_useContextWithBailout = + throwInvalidHookError; var HooksDispatcherOnMountInDEV = null, HooksDispatcherOnMountWithHookTypesInDEV = null, HooksDispatcherOnUpdateInDEV = null, @@ -25661,6 +25718,14 @@ __DEV__ && mountHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnMountInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + mountHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnMountWithHookTypesInDEV = { readContext: function (context) { return readContext(context); @@ -25806,6 +25871,12 @@ __DEV__ && updateHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnMountWithHookTypesInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnUpdateInDEV = { readContext: function (context) { return readContext(context); @@ -25944,6 +26015,14 @@ __DEV__ && updateHookTypesDev(); return updateOptimistic(passthrough, reducer); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnRerenderInDEV = { readContext: function (context) { return readContext(context); @@ -26082,6 +26161,14 @@ __DEV__ && updateHookTypesDev(); return rerenderOptimistic(passthrough, reducer); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnMountInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -26250,6 +26337,15 @@ __DEV__ && mountHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnUpdateInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -26415,6 +26511,13 @@ __DEV__ && updateHookTypesDev(); return updateOptimistic(passthrough, reducer); }; + InvalidNestedHooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnRerenderInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -26582,6 +26685,13 @@ __DEV__ && updateHookTypesDev(); return rerenderOptimistic(passthrough, reducer); }; + InvalidNestedHooksDispatcherOnRerenderInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; var now = Scheduler.unstable_now, commitTime = 0, layoutEffectStartTime = -1, @@ -27695,11 +27805,11 @@ __DEV__ && : flushSyncErrorInBuildsThatSupportLegacyMode; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-www-classic-7f217d1d-20240725" !== isomorphicReactPackageVersion) + if ("19.0.0-www-classic-b9af819f-20240726" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-www-classic-7f217d1d-20240725\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-www-classic-b9af819f-20240726\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -27765,12 +27875,12 @@ __DEV__ && scheduleRoot: scheduleRoot, setRefreshHandler: setRefreshHandler, getCurrentFiber: getCurrentFiberForDevTools, - reconcilerVersion: "19.0.0-www-classic-7f217d1d-20240725" + reconcilerVersion: "19.0.0-www-classic-b9af819f-20240726" }); })({ findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 1, - version: "19.0.0-www-classic-7f217d1d-20240725", + version: "19.0.0-www-classic-b9af819f-20240726", rendererPackageName: "react-dom" }) && canUseDOM && @@ -28406,7 +28516,7 @@ __DEV__ && exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.0.0-www-classic-7f217d1d-20240725"; + exports.version = "19.0.0-www-classic-b9af819f-20240726"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled/facebook-www/ReactDOM-dev.modern.js b/compiled/facebook-www/ReactDOM-dev.modern.js index 0d4ffb65a0649..15173b90aa0af 100644 --- a/compiled/facebook-www/ReactDOM-dev.modern.js +++ b/compiled/facebook-www/ReactDOM-dev.modern.js @@ -5831,6 +5831,32 @@ __DEV__ && } return workInProgressHook; } + function unstable_useContextWithBailout(context, select) { + if (null === select) return readContext(context); + if (!enableLazyContextPropagation) throw Error("Not implemented."); + var consumer = currentlyRenderingFiber, + value = context._currentValue; + if (lastFullyObservedContext !== context) + if ( + ((context = { + context: context, + memoizedValue: value, + next: null, + select: select, + lastSelectedValue: select(value) + }), + null === lastContextDependency) + ) { + if (null === consumer) + throw Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + enableLazyContextPropagation && (consumer.flags |= 524288); + } else lastContextDependency = lastContextDependency.next = context; + return value; + } function useThenable(thenable) { var index = thenableIndexCounter; thenableIndexCounter += 1; @@ -8855,32 +8881,32 @@ __DEV__ && return current; } function updateSuspenseComponent(current, workInProgress, renderLanes) { - var JSCompiler_object_inline_digest_2452; - var JSCompiler_object_inline_stack_2453 = workInProgress.pendingProps; + var JSCompiler_object_inline_digest_2462; + var JSCompiler_object_inline_stack_2463 = workInProgress.pendingProps; shouldSuspendImpl(workInProgress) && (workInProgress.flags |= 128); - var JSCompiler_object_inline_componentStack_2454 = !1; + var JSCompiler_object_inline_componentStack_2464 = !1; var didSuspend = 0 !== (workInProgress.flags & 128); - (JSCompiler_object_inline_digest_2452 = didSuspend) || - (JSCompiler_object_inline_digest_2452 = + (JSCompiler_object_inline_digest_2462 = didSuspend) || + (JSCompiler_object_inline_digest_2462 = null !== current && null === current.memoizedState ? !1 : 0 !== (suspenseStackCursor.current & ForceSuspenseFallback)); - JSCompiler_object_inline_digest_2452 && - ((JSCompiler_object_inline_componentStack_2454 = !0), + JSCompiler_object_inline_digest_2462 && + ((JSCompiler_object_inline_componentStack_2464 = !0), (workInProgress.flags &= -129)); - JSCompiler_object_inline_digest_2452 = 0 !== (workInProgress.flags & 32); + JSCompiler_object_inline_digest_2462 = 0 !== (workInProgress.flags & 32); workInProgress.flags &= -33; if (null === current) { if (isHydrating) { - JSCompiler_object_inline_componentStack_2454 + JSCompiler_object_inline_componentStack_2464 ? pushPrimaryTreeSuspenseHandler(workInProgress) : reuseSuspenseHandlerOnStack(workInProgress); if (isHydrating) { - var JSCompiler_object_inline_message_2451 = nextHydratableInstance; + var JSCompiler_object_inline_message_2461 = nextHydratableInstance; var JSCompiler_temp; - if (!(JSCompiler_temp = !JSCompiler_object_inline_message_2451)) { + if (!(JSCompiler_temp = !JSCompiler_object_inline_message_2461)) { c: { - var instance = JSCompiler_object_inline_message_2451; + var instance = JSCompiler_object_inline_message_2461; for ( JSCompiler_temp = rootOrSingletonContext; instance.nodeType !== COMMENT_NODE; @@ -8921,19 +8947,19 @@ __DEV__ && JSCompiler_temp && (warnNonHydratedInstance( workInProgress, - JSCompiler_object_inline_message_2451 + JSCompiler_object_inline_message_2461 ), throwOnHydrationMismatch(workInProgress)); } - JSCompiler_object_inline_message_2451 = workInProgress.memoizedState; + JSCompiler_object_inline_message_2461 = workInProgress.memoizedState; if ( - null !== JSCompiler_object_inline_message_2451 && - ((JSCompiler_object_inline_message_2451 = - JSCompiler_object_inline_message_2451.dehydrated), - null !== JSCompiler_object_inline_message_2451) + null !== JSCompiler_object_inline_message_2461 && + ((JSCompiler_object_inline_message_2461 = + JSCompiler_object_inline_message_2461.dehydrated), + null !== JSCompiler_object_inline_message_2461) ) return ( - JSCompiler_object_inline_message_2451.data === + JSCompiler_object_inline_message_2461.data === SUSPENSE_FALLBACK_START_DATA ? (workInProgress.lanes = DefaultHydrationLane) : (workInProgress.lanes = OffscreenLane), @@ -8941,27 +8967,27 @@ __DEV__ && ); popSuspenseHandler(workInProgress); } - JSCompiler_object_inline_message_2451 = - JSCompiler_object_inline_stack_2453.children; - JSCompiler_temp = JSCompiler_object_inline_stack_2453.fallback; - if (JSCompiler_object_inline_componentStack_2454) + JSCompiler_object_inline_message_2461 = + JSCompiler_object_inline_stack_2463.children; + JSCompiler_temp = JSCompiler_object_inline_stack_2463.fallback; + if (JSCompiler_object_inline_componentStack_2464) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_stack_2453 = + (JSCompiler_object_inline_stack_2463 = mountSuspenseFallbackChildren( workInProgress, - JSCompiler_object_inline_message_2451, + JSCompiler_object_inline_message_2461, JSCompiler_temp, renderLanes )), - (JSCompiler_object_inline_componentStack_2454 = + (JSCompiler_object_inline_componentStack_2464 = workInProgress.child), - (JSCompiler_object_inline_componentStack_2454.memoizedState = + (JSCompiler_object_inline_componentStack_2464.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_componentStack_2454.childLanes = + (JSCompiler_object_inline_componentStack_2464.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2452, + JSCompiler_object_inline_digest_2462, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), @@ -8974,9 +9000,9 @@ __DEV__ && ? markerInstanceStack.current : null), (renderLanes = - JSCompiler_object_inline_componentStack_2454.updateQueue), + JSCompiler_object_inline_componentStack_2464.updateQueue), null === renderLanes - ? (JSCompiler_object_inline_componentStack_2454.updateQueue = + ? (JSCompiler_object_inline_componentStack_2464.updateQueue = { transitions: workInProgress, markerInstances: current, @@ -8984,46 +9010,46 @@ __DEV__ && }) : ((renderLanes.transitions = workInProgress), (renderLanes.markerInstances = current)))), - JSCompiler_object_inline_stack_2453 + JSCompiler_object_inline_stack_2463 ); if ( "number" === - typeof JSCompiler_object_inline_stack_2453.unstable_expectedLoadTime + typeof JSCompiler_object_inline_stack_2463.unstable_expectedLoadTime ) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_stack_2453 = + (JSCompiler_object_inline_stack_2463 = mountSuspenseFallbackChildren( workInProgress, - JSCompiler_object_inline_message_2451, + JSCompiler_object_inline_message_2461, JSCompiler_temp, renderLanes )), - (JSCompiler_object_inline_componentStack_2454 = + (JSCompiler_object_inline_componentStack_2464 = workInProgress.child), - (JSCompiler_object_inline_componentStack_2454.memoizedState = + (JSCompiler_object_inline_componentStack_2464.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_componentStack_2454.childLanes = + (JSCompiler_object_inline_componentStack_2464.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2452, + JSCompiler_object_inline_digest_2462, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress.lanes = 4194304), - JSCompiler_object_inline_stack_2453 + JSCompiler_object_inline_stack_2463 ); pushPrimaryTreeSuspenseHandler(workInProgress); return mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_message_2451 + JSCompiler_object_inline_message_2461 ); } var prevState = current.memoizedState; if ( null !== prevState && - ((JSCompiler_object_inline_message_2451 = prevState.dehydrated), - null !== JSCompiler_object_inline_message_2451) + ((JSCompiler_object_inline_message_2461 = prevState.dehydrated), + null !== JSCompiler_object_inline_message_2461) ) { if (didSuspend) workInProgress.flags & 256 @@ -9040,94 +9066,94 @@ __DEV__ && (workInProgress.flags |= 128), (workInProgress = null)) : (reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_componentStack_2454 = - JSCompiler_object_inline_stack_2453.fallback), - (JSCompiler_object_inline_message_2451 = workInProgress.mode), - (JSCompiler_object_inline_stack_2453 = + (JSCompiler_object_inline_componentStack_2464 = + JSCompiler_object_inline_stack_2463.fallback), + (JSCompiler_object_inline_message_2461 = workInProgress.mode), + (JSCompiler_object_inline_stack_2463 = mountWorkInProgressOffscreenFiber( { mode: "visible", - children: JSCompiler_object_inline_stack_2453.children + children: JSCompiler_object_inline_stack_2463.children }, - JSCompiler_object_inline_message_2451 + JSCompiler_object_inline_message_2461 )), - (JSCompiler_object_inline_componentStack_2454 = + (JSCompiler_object_inline_componentStack_2464 = createFiberFromFragment( - JSCompiler_object_inline_componentStack_2454, - JSCompiler_object_inline_message_2451, + JSCompiler_object_inline_componentStack_2464, + JSCompiler_object_inline_message_2461, renderLanes, null )), - (JSCompiler_object_inline_componentStack_2454.flags |= 2), - (JSCompiler_object_inline_stack_2453.return = workInProgress), - (JSCompiler_object_inline_componentStack_2454.return = + (JSCompiler_object_inline_componentStack_2464.flags |= 2), + (JSCompiler_object_inline_stack_2463.return = workInProgress), + (JSCompiler_object_inline_componentStack_2464.return = workInProgress), - (JSCompiler_object_inline_stack_2453.sibling = - JSCompiler_object_inline_componentStack_2454), - (workInProgress.child = JSCompiler_object_inline_stack_2453), + (JSCompiler_object_inline_stack_2463.sibling = + JSCompiler_object_inline_componentStack_2464), + (workInProgress.child = JSCompiler_object_inline_stack_2463), reconcileChildFibers( workInProgress, current.child, null, renderLanes ), - (JSCompiler_object_inline_stack_2453 = workInProgress.child), - (JSCompiler_object_inline_stack_2453.memoizedState = + (JSCompiler_object_inline_stack_2463 = workInProgress.child), + (JSCompiler_object_inline_stack_2463.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_stack_2453.childLanes = + (JSCompiler_object_inline_stack_2463.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2452, + JSCompiler_object_inline_digest_2462, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress = - JSCompiler_object_inline_componentStack_2454)); + JSCompiler_object_inline_componentStack_2464)); else if ( (pushPrimaryTreeSuspenseHandler(workInProgress), isHydrating && error$jscomp$0( "We should not be hydrating here. This is a bug in React. Please file a bug." ), - JSCompiler_object_inline_message_2451.data === + JSCompiler_object_inline_message_2461.data === SUSPENSE_FALLBACK_START_DATA) ) { - JSCompiler_object_inline_digest_2452 = - JSCompiler_object_inline_message_2451.nextSibling && - JSCompiler_object_inline_message_2451.nextSibling.dataset; - if (JSCompiler_object_inline_digest_2452) { - JSCompiler_temp = JSCompiler_object_inline_digest_2452.dgst; - var message = JSCompiler_object_inline_digest_2452.msg; - instance = JSCompiler_object_inline_digest_2452.stck; - var componentStack = JSCompiler_object_inline_digest_2452.cstck; + JSCompiler_object_inline_digest_2462 = + JSCompiler_object_inline_message_2461.nextSibling && + JSCompiler_object_inline_message_2461.nextSibling.dataset; + if (JSCompiler_object_inline_digest_2462) { + JSCompiler_temp = JSCompiler_object_inline_digest_2462.dgst; + var message = JSCompiler_object_inline_digest_2462.msg; + instance = JSCompiler_object_inline_digest_2462.stck; + var componentStack = JSCompiler_object_inline_digest_2462.cstck; } - JSCompiler_object_inline_message_2451 = message; - JSCompiler_object_inline_digest_2452 = JSCompiler_temp; - JSCompiler_object_inline_stack_2453 = instance; - JSCompiler_object_inline_componentStack_2454 = componentStack; - JSCompiler_object_inline_message_2451 = - JSCompiler_object_inline_message_2451 - ? Error(JSCompiler_object_inline_message_2451) + JSCompiler_object_inline_message_2461 = message; + JSCompiler_object_inline_digest_2462 = JSCompiler_temp; + JSCompiler_object_inline_stack_2463 = instance; + JSCompiler_object_inline_componentStack_2464 = componentStack; + JSCompiler_object_inline_message_2461 = + JSCompiler_object_inline_message_2461 + ? Error(JSCompiler_object_inline_message_2461) : Error( "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." ); - JSCompiler_object_inline_message_2451.stack = - JSCompiler_object_inline_stack_2453 || ""; - JSCompiler_object_inline_message_2451.digest = - JSCompiler_object_inline_digest_2452; - JSCompiler_object_inline_digest_2452 = - void 0 === JSCompiler_object_inline_componentStack_2454 + JSCompiler_object_inline_message_2461.stack = + JSCompiler_object_inline_stack_2463 || ""; + JSCompiler_object_inline_message_2461.digest = + JSCompiler_object_inline_digest_2462; + JSCompiler_object_inline_digest_2462 = + void 0 === JSCompiler_object_inline_componentStack_2464 ? null - : JSCompiler_object_inline_componentStack_2454; - "string" === typeof JSCompiler_object_inline_digest_2452 && + : JSCompiler_object_inline_componentStack_2464; + "string" === typeof JSCompiler_object_inline_digest_2462 && CapturedStacks.set( - JSCompiler_object_inline_message_2451, - JSCompiler_object_inline_digest_2452 + JSCompiler_object_inline_message_2461, + JSCompiler_object_inline_digest_2462 ); queueHydrationError({ - value: JSCompiler_object_inline_message_2451, + value: JSCompiler_object_inline_message_2461, source: null, - stack: JSCompiler_object_inline_digest_2452 + stack: JSCompiler_object_inline_digest_2462 }); workInProgress = retrySuspenseComponentWithoutHydrating( current, @@ -9143,26 +9169,26 @@ __DEV__ && renderLanes, !1 ), - (JSCompiler_object_inline_digest_2452 = + (JSCompiler_object_inline_digest_2462 = 0 !== (renderLanes & current.childLanes)), - didReceiveUpdate || JSCompiler_object_inline_digest_2452) + didReceiveUpdate || JSCompiler_object_inline_digest_2462) ) { - JSCompiler_object_inline_digest_2452 = workInProgressRoot; - if (null !== JSCompiler_object_inline_digest_2452) { - JSCompiler_object_inline_stack_2453 = renderLanes & -renderLanes; - if (0 !== (JSCompiler_object_inline_stack_2453 & SyncUpdateLanes)) - JSCompiler_object_inline_stack_2453 = SyncHydrationLane; + JSCompiler_object_inline_digest_2462 = workInProgressRoot; + if (null !== JSCompiler_object_inline_digest_2462) { + JSCompiler_object_inline_stack_2463 = renderLanes & -renderLanes; + if (0 !== (JSCompiler_object_inline_stack_2463 & SyncUpdateLanes)) + JSCompiler_object_inline_stack_2463 = SyncHydrationLane; else - switch (JSCompiler_object_inline_stack_2453) { + switch (JSCompiler_object_inline_stack_2463) { case SyncLane: - JSCompiler_object_inline_stack_2453 = SyncHydrationLane; + JSCompiler_object_inline_stack_2463 = SyncHydrationLane; break; case InputContinuousLane: - JSCompiler_object_inline_stack_2453 = + JSCompiler_object_inline_stack_2463 = InputContinuousHydrationLane; break; case DefaultLane: - JSCompiler_object_inline_stack_2453 = DefaultHydrationLane; + JSCompiler_object_inline_stack_2463 = DefaultHydrationLane; break; case 128: case 256: @@ -9183,40 +9209,40 @@ __DEV__ && case 8388608: case 16777216: case 33554432: - JSCompiler_object_inline_stack_2453 = TransitionHydrationLane; + JSCompiler_object_inline_stack_2463 = TransitionHydrationLane; break; case IdleLane: - JSCompiler_object_inline_stack_2453 = IdleHydrationLane; + JSCompiler_object_inline_stack_2463 = IdleHydrationLane; break; default: - JSCompiler_object_inline_stack_2453 = 0; + JSCompiler_object_inline_stack_2463 = 0; } - JSCompiler_object_inline_stack_2453 = + JSCompiler_object_inline_stack_2463 = 0 !== - (JSCompiler_object_inline_stack_2453 & - (JSCompiler_object_inline_digest_2452.suspendedLanes | + (JSCompiler_object_inline_stack_2463 & + (JSCompiler_object_inline_digest_2462.suspendedLanes | renderLanes)) ? 0 - : JSCompiler_object_inline_stack_2453; + : JSCompiler_object_inline_stack_2463; if ( - 0 !== JSCompiler_object_inline_stack_2453 && - JSCompiler_object_inline_stack_2453 !== prevState.retryLane + 0 !== JSCompiler_object_inline_stack_2463 && + JSCompiler_object_inline_stack_2463 !== prevState.retryLane ) throw ( - ((prevState.retryLane = JSCompiler_object_inline_stack_2453), + ((prevState.retryLane = JSCompiler_object_inline_stack_2463), enqueueConcurrentRenderForLane( current, - JSCompiler_object_inline_stack_2453 + JSCompiler_object_inline_stack_2463 ), scheduleUpdateOnFiber( - JSCompiler_object_inline_digest_2452, + JSCompiler_object_inline_digest_2462, current, - JSCompiler_object_inline_stack_2453 + JSCompiler_object_inline_stack_2463 ), SelectiveHydrationException) ); } - JSCompiler_object_inline_message_2451.data === + JSCompiler_object_inline_message_2461.data === SUSPENSE_PENDING_START_DATA || renderDidSuspendDelayIfPossible(); workInProgress = retrySuspenseComponentWithoutHydrating( current, @@ -9224,7 +9250,7 @@ __DEV__ && renderLanes ); } else - JSCompiler_object_inline_message_2451.data === + JSCompiler_object_inline_message_2461.data === SUSPENSE_PENDING_START_DATA ? ((workInProgress.flags |= 128), (workInProgress.child = current.child), @@ -9232,12 +9258,12 @@ __DEV__ && null, current )), - (JSCompiler_object_inline_message_2451._reactRetry = + (JSCompiler_object_inline_message_2461._reactRetry = workInProgress), (workInProgress = null)) : ((current = prevState.treeContext), (nextHydratableInstance = getNextHydratable( - JSCompiler_object_inline_message_2451.nextSibling + JSCompiler_object_inline_message_2461.nextSibling )), (hydrationParentFiber = workInProgress), (isHydrating = !0), @@ -9255,57 +9281,57 @@ __DEV__ && (treeContextProvider = workInProgress)), (workInProgress = mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_stack_2453.children + JSCompiler_object_inline_stack_2463.children )), (workInProgress.flags |= 4096)); return workInProgress; } - if (JSCompiler_object_inline_componentStack_2454) + if (JSCompiler_object_inline_componentStack_2464) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_componentStack_2454 = - JSCompiler_object_inline_stack_2453.fallback), - (JSCompiler_object_inline_message_2451 = workInProgress.mode), + (JSCompiler_object_inline_componentStack_2464 = + JSCompiler_object_inline_stack_2463.fallback), + (JSCompiler_object_inline_message_2461 = workInProgress.mode), (JSCompiler_temp = current.child), (instance = JSCompiler_temp.sibling), - (JSCompiler_object_inline_stack_2453 = createWorkInProgress( + (JSCompiler_object_inline_stack_2463 = createWorkInProgress( JSCompiler_temp, { mode: "hidden", - children: JSCompiler_object_inline_stack_2453.children + children: JSCompiler_object_inline_stack_2463.children } )), - (JSCompiler_object_inline_stack_2453.subtreeFlags = + (JSCompiler_object_inline_stack_2463.subtreeFlags = JSCompiler_temp.subtreeFlags & 31457280), null !== instance - ? (JSCompiler_object_inline_componentStack_2454 = + ? (JSCompiler_object_inline_componentStack_2464 = createWorkInProgress( instance, - JSCompiler_object_inline_componentStack_2454 + JSCompiler_object_inline_componentStack_2464 )) - : ((JSCompiler_object_inline_componentStack_2454 = + : ((JSCompiler_object_inline_componentStack_2464 = createFiberFromFragment( - JSCompiler_object_inline_componentStack_2454, - JSCompiler_object_inline_message_2451, + JSCompiler_object_inline_componentStack_2464, + JSCompiler_object_inline_message_2461, renderLanes, null )), - (JSCompiler_object_inline_componentStack_2454.flags |= 2)), - (JSCompiler_object_inline_componentStack_2454.return = + (JSCompiler_object_inline_componentStack_2464.flags |= 2)), + (JSCompiler_object_inline_componentStack_2464.return = workInProgress), - (JSCompiler_object_inline_stack_2453.return = workInProgress), - (JSCompiler_object_inline_stack_2453.sibling = - JSCompiler_object_inline_componentStack_2454), - (workInProgress.child = JSCompiler_object_inline_stack_2453), - (JSCompiler_object_inline_stack_2453 = - JSCompiler_object_inline_componentStack_2454), - (JSCompiler_object_inline_componentStack_2454 = workInProgress.child), - (JSCompiler_object_inline_message_2451 = current.child.memoizedState), - null === JSCompiler_object_inline_message_2451 - ? (JSCompiler_object_inline_message_2451 = + (JSCompiler_object_inline_stack_2463.return = workInProgress), + (JSCompiler_object_inline_stack_2463.sibling = + JSCompiler_object_inline_componentStack_2464), + (workInProgress.child = JSCompiler_object_inline_stack_2463), + (JSCompiler_object_inline_stack_2463 = + JSCompiler_object_inline_componentStack_2464), + (JSCompiler_object_inline_componentStack_2464 = workInProgress.child), + (JSCompiler_object_inline_message_2461 = current.child.memoizedState), + null === JSCompiler_object_inline_message_2461 + ? (JSCompiler_object_inline_message_2461 = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = - JSCompiler_object_inline_message_2451.cachePool), + JSCompiler_object_inline_message_2461.cachePool), null !== JSCompiler_temp ? ((instance = CacheContext._currentValue), (JSCompiler_temp = @@ -9313,34 +9339,34 @@ __DEV__ && ? { parent: instance, pool: instance } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), - (JSCompiler_object_inline_message_2451 = { + (JSCompiler_object_inline_message_2461 = { baseLanes: - JSCompiler_object_inline_message_2451.baseLanes | renderLanes, + JSCompiler_object_inline_message_2461.baseLanes | renderLanes, cachePool: JSCompiler_temp })), - (JSCompiler_object_inline_componentStack_2454.memoizedState = - JSCompiler_object_inline_message_2451), + (JSCompiler_object_inline_componentStack_2464.memoizedState = + JSCompiler_object_inline_message_2461), enableTransitionTracing && - ((JSCompiler_object_inline_message_2451 = enableTransitionTracing + ((JSCompiler_object_inline_message_2461 = enableTransitionTracing ? transitionStack.current : null), - null !== JSCompiler_object_inline_message_2451 && + null !== JSCompiler_object_inline_message_2461 && ((JSCompiler_temp = enableTransitionTracing ? markerInstanceStack.current : null), (instance = - JSCompiler_object_inline_componentStack_2454.updateQueue), + JSCompiler_object_inline_componentStack_2464.updateQueue), (componentStack = current.updateQueue), null === instance - ? (JSCompiler_object_inline_componentStack_2454.updateQueue = { - transitions: JSCompiler_object_inline_message_2451, + ? (JSCompiler_object_inline_componentStack_2464.updateQueue = { + transitions: JSCompiler_object_inline_message_2461, markerInstances: JSCompiler_temp, retryQueue: null }) : instance === componentStack - ? (JSCompiler_object_inline_componentStack_2454.updateQueue = + ? (JSCompiler_object_inline_componentStack_2464.updateQueue = { - transitions: JSCompiler_object_inline_message_2451, + transitions: JSCompiler_object_inline_message_2461, markerInstances: JSCompiler_temp, retryQueue: null !== componentStack @@ -9348,32 +9374,32 @@ __DEV__ && : null }) : ((instance.transitions = - JSCompiler_object_inline_message_2451), + JSCompiler_object_inline_message_2461), (instance.markerInstances = JSCompiler_temp)))), - (JSCompiler_object_inline_componentStack_2454.childLanes = + (JSCompiler_object_inline_componentStack_2464.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2452, + JSCompiler_object_inline_digest_2462, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2453 + JSCompiler_object_inline_stack_2463 ); pushPrimaryTreeSuspenseHandler(workInProgress); renderLanes = current.child; current = renderLanes.sibling; renderLanes = createWorkInProgress(renderLanes, { mode: "visible", - children: JSCompiler_object_inline_stack_2453.children + children: JSCompiler_object_inline_stack_2463.children }); renderLanes.return = workInProgress; renderLanes.sibling = null; null !== current && - ((JSCompiler_object_inline_digest_2452 = workInProgress.deletions), - null === JSCompiler_object_inline_digest_2452 + ((JSCompiler_object_inline_digest_2462 = workInProgress.deletions), + null === JSCompiler_object_inline_digest_2462 ? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16)) - : JSCompiler_object_inline_digest_2452.push(current)); + : JSCompiler_object_inline_digest_2462.push(current)); workInProgress.child = renderLanes; workInProgress.memoizedState = null; return renderLanes; @@ -10756,8 +10782,19 @@ __DEV__ && a: for (; null !== list; ) { var dependency = list; list = fiber; - for (var i = 0; i < contexts.length; i++) + var i = 0; + b: for (; i < contexts.length; i++) if (dependency.context === contexts[i]) { + var select = dependency.select; + if ( + null != select && + null != dependency.lastSelectedValue && + !checkIfSelectedContextValuesChanged( + dependency.lastSelectedValue, + select(dependency.context._currentValue) + ) + ) + continue b; list.lanes |= renderLanes; dependency = list.alternate; null !== dependency && (dependency.lanes |= renderLanes); @@ -10862,6 +10899,17 @@ __DEV__ && workInProgress.flags |= 262144; } } + function checkIfSelectedContextValuesChanged( + oldComparedValue, + newComparedValue + ) { + if (isArrayImpl(oldComparedValue) && isArrayImpl(newComparedValue)) { + if (oldComparedValue.length !== newComparedValue.length) return !0; + for (var i = 0; i < oldComparedValue.length; i++) + if (!objectIs(newComparedValue[i], oldComparedValue[i])) return !0; + } else throw Error("Compared context values must be arrays"); + return !1; + } function checkIfContextChanged(currentDependencies) { if (!enableLazyContextPropagation) return !1; for ( @@ -10869,13 +10917,20 @@ __DEV__ && null !== currentDependencies; ) { + var newValue = currentDependencies.context._currentValue, + oldValue = currentDependencies.memoizedValue; if ( - !objectIs( - currentDependencies.context._currentValue, - currentDependencies.memoizedValue + null != currentDependencies.select && + null != currentDependencies.lastSelectedValue + ) { + if ( + checkIfSelectedContextValuesChanged( + currentDependencies.lastSelectedValue, + currentDependencies.select(newValue) + ) ) - ) - return !0; + return !0; + } else if (!objectIs(newValue, oldValue)) return !0; currentDependencies = currentDependencies.next; } return !1; @@ -24614,6 +24669,8 @@ __DEV__ && ContextOnlyDispatcher.useFormState = throwInvalidHookError; ContextOnlyDispatcher.useActionState = throwInvalidHookError; ContextOnlyDispatcher.useOptimistic = throwInvalidHookError; + ContextOnlyDispatcher.unstable_useContextWithBailout = + throwInvalidHookError; var HooksDispatcherOnMountInDEV = null, HooksDispatcherOnMountWithHookTypesInDEV = null, HooksDispatcherOnUpdateInDEV = null, @@ -24765,6 +24822,14 @@ __DEV__ && mountHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnMountInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + mountHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnMountWithHookTypesInDEV = { readContext: function (context) { return readContext(context); @@ -24910,6 +24975,12 @@ __DEV__ && updateHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnMountWithHookTypesInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnUpdateInDEV = { readContext: function (context) { return readContext(context); @@ -25048,6 +25119,14 @@ __DEV__ && updateHookTypesDev(); return updateOptimistic(passthrough, reducer); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnRerenderInDEV = { readContext: function (context) { return readContext(context); @@ -25186,6 +25265,14 @@ __DEV__ && updateHookTypesDev(); return rerenderOptimistic(passthrough, reducer); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnMountInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -25354,6 +25441,15 @@ __DEV__ && mountHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnUpdateInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -25519,6 +25615,13 @@ __DEV__ && updateHookTypesDev(); return updateOptimistic(passthrough, reducer); }; + InvalidNestedHooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnRerenderInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -25686,6 +25789,13 @@ __DEV__ && updateHookTypesDev(); return rerenderOptimistic(passthrough, reducer); }; + InvalidNestedHooksDispatcherOnRerenderInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; var now = Scheduler.unstable_now, commitTime = 0, layoutEffectStartTime = -1, @@ -26797,11 +26907,11 @@ __DEV__ && return_targetInst = null; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-www-modern-7f217d1d-20240725" !== isomorphicReactPackageVersion) + if ("19.0.0-www-modern-b9af819f-20240726" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-www-modern-7f217d1d-20240725\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-www-modern-b9af819f-20240726\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -26866,12 +26976,12 @@ __DEV__ && scheduleRoot: scheduleRoot, setRefreshHandler: setRefreshHandler, getCurrentFiber: getCurrentFiberForDevTools, - reconcilerVersion: "19.0.0-www-modern-7f217d1d-20240725" + reconcilerVersion: "19.0.0-www-modern-b9af819f-20240726" }); })({ findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 1, - version: "19.0.0-www-modern-7f217d1d-20240725", + version: "19.0.0-www-modern-b9af819f-20240726", rendererPackageName: "react-dom" }) && canUseDOM && @@ -27459,7 +27569,7 @@ __DEV__ && exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.0.0-www-modern-7f217d1d-20240725"; + exports.version = "19.0.0-www-modern-b9af819f-20240726"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled/facebook-www/ReactDOM-prod.classic.js b/compiled/facebook-www/ReactDOM-prod.classic.js index e16ab6c018c88..138cd33b667e9 100644 --- a/compiled/facebook-www/ReactDOM-prod.classic.js +++ b/compiled/facebook-www/ReactDOM-prod.classic.js @@ -3450,6 +3450,29 @@ function updateWorkInProgressHook() { } return workInProgressHook; } +function unstable_useContextWithBailout(context, select) { + if (null === select) return readContext(context); + if (!enableLazyContextPropagation) throw Error(formatProdErrorMessage(248)); + var consumer = currentlyRenderingFiber, + value = context._currentValue; + if (lastFullyObservedContext !== context) + if ( + ((context = { + context: context, + memoizedValue: value, + next: null, + select: select, + lastSelectedValue: select(value) + }), + null === lastContextDependency) + ) { + if (null === consumer) throw Error(formatProdErrorMessage(308)); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + enableLazyContextPropagation && (consumer.flags |= 524288); + } else lastContextDependency = lastContextDependency.next = context; + return value; +} var createFunctionComponentUpdateQueue; createFunctionComponentUpdateQueue = function () { return { lastEffect: null, events: null, stores: null, memoCache: null }; @@ -4407,6 +4430,7 @@ ContextOnlyDispatcher.useHostTransitionStatus = throwInvalidHookError; ContextOnlyDispatcher.useFormState = throwInvalidHookError; ContextOnlyDispatcher.useActionState = throwInvalidHookError; ContextOnlyDispatcher.useOptimistic = throwInvalidHookError; +ContextOnlyDispatcher.unstable_useContextWithBailout = throwInvalidHookError; var HooksDispatcherOnMount = { readContext: readContext, use: use, @@ -4599,6 +4623,8 @@ HooksDispatcherOnMount.useOptimistic = function (passthrough) { queue.dispatch = hook; return [passthrough, hook]; }; +HooksDispatcherOnMount.unstable_useContextWithBailout = + unstable_useContextWithBailout; var HooksDispatcherOnUpdate = { readContext: readContext, use: use, @@ -4647,6 +4673,8 @@ HooksDispatcherOnUpdate.useOptimistic = function (passthrough, reducer) { var hook = updateWorkInProgressHook(); return updateOptimisticImpl(hook, currentHook, passthrough, reducer); }; +HooksDispatcherOnUpdate.unstable_useContextWithBailout = + unstable_useContextWithBailout; var HooksDispatcherOnRerender = { readContext: readContext, use: use, @@ -4700,6 +4728,8 @@ HooksDispatcherOnRerender.useOptimistic = function (passthrough, reducer) { hook.baseState = passthrough; return [passthrough, hook.queue.dispatch]; }; +HooksDispatcherOnRerender.unstable_useContextWithBailout = + unstable_useContextWithBailout; function applyDerivedStateFromProps( workInProgress, ctor, @@ -7429,8 +7459,19 @@ function propagateContextChanges( a: for (; null !== list; ) { var dependency = list; list = fiber; - for (var i = 0; i < contexts.length; i++) + var i = 0; + b: for (; i < contexts.length; i++) if (dependency.context === contexts[i]) { + var select = dependency.select; + if ( + null != select && + null != dependency.lastSelectedValue && + !checkIfSelectedContextValuesChanged( + dependency.lastSelectedValue, + select(dependency.context._currentValue) + ) + ) + continue b; list.lanes |= renderLanes; dependency = list.alternate; null !== dependency && (dependency.lanes |= renderLanes); @@ -7520,6 +7561,17 @@ function propagateParentContextChanges( workInProgress.flags |= 262144; } } +function checkIfSelectedContextValuesChanged( + oldComparedValue, + newComparedValue +) { + if (isArrayImpl(oldComparedValue) && isArrayImpl(newComparedValue)) { + if (oldComparedValue.length !== newComparedValue.length) return !0; + for (var i = 0; i < oldComparedValue.length; i++) + if (!objectIs(newComparedValue[i], oldComparedValue[i])) return !0; + } else throw Error(formatProdErrorMessage(541)); + return !1; +} function checkIfContextChanged(currentDependencies) { if (!enableLazyContextPropagation) return !1; for ( @@ -7527,13 +7579,20 @@ function checkIfContextChanged(currentDependencies) { null !== currentDependencies; ) { + var newValue = currentDependencies.context._currentValue, + oldValue = currentDependencies.memoizedValue; if ( - !objectIs( - currentDependencies.context._currentValue, - currentDependencies.memoizedValue + null != currentDependencies.select && + null != currentDependencies.lastSelectedValue + ) { + if ( + checkIfSelectedContextValuesChanged( + currentDependencies.lastSelectedValue, + currentDependencies.select(newValue) + ) ) - ) - return !0; + return !0; + } else if (!objectIs(newValue, oldValue)) return !0; currentDependencies = currentDependencies.next; } return !1; @@ -13196,19 +13255,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$388; + var JSCompiler_inline_result$jscomp$389; if (canUseDOM) { - var isSupported$jscomp$inline_1558 = "oninput" in document; - if (!isSupported$jscomp$inline_1558) { - var element$jscomp$inline_1559 = document.createElement("div"); - element$jscomp$inline_1559.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1558 = - "function" === typeof element$jscomp$inline_1559.oninput; + var isSupported$jscomp$inline_1562 = "oninput" in document; + if (!isSupported$jscomp$inline_1562) { + var element$jscomp$inline_1563 = document.createElement("div"); + element$jscomp$inline_1563.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1562 = + "function" === typeof element$jscomp$inline_1563.oninput; } - JSCompiler_inline_result$jscomp$388 = isSupported$jscomp$inline_1558; - } else JSCompiler_inline_result$jscomp$388 = !1; + JSCompiler_inline_result$jscomp$389 = isSupported$jscomp$inline_1562; + } else JSCompiler_inline_result$jscomp$389 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$388 && + JSCompiler_inline_result$jscomp$389 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -13619,20 +13678,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1599 = 0; - i$jscomp$inline_1599 < simpleEventPluginEvents.length; - i$jscomp$inline_1599++ + var i$jscomp$inline_1603 = 0; + i$jscomp$inline_1603 < simpleEventPluginEvents.length; + i$jscomp$inline_1603++ ) { - var eventName$jscomp$inline_1600 = - simpleEventPluginEvents[i$jscomp$inline_1599], - domEventName$jscomp$inline_1601 = - eventName$jscomp$inline_1600.toLowerCase(), - capitalizedEvent$jscomp$inline_1602 = - eventName$jscomp$inline_1600[0].toUpperCase() + - eventName$jscomp$inline_1600.slice(1); + var eventName$jscomp$inline_1604 = + simpleEventPluginEvents[i$jscomp$inline_1603], + domEventName$jscomp$inline_1605 = + eventName$jscomp$inline_1604.toLowerCase(), + capitalizedEvent$jscomp$inline_1606 = + eventName$jscomp$inline_1604[0].toUpperCase() + + eventName$jscomp$inline_1604.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1601, - "on" + capitalizedEvent$jscomp$inline_1602 + domEventName$jscomp$inline_1605, + "on" + capitalizedEvent$jscomp$inline_1606 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -17233,16 +17292,16 @@ function getCrossOriginStringAs(as, input) { if ("string" === typeof input) return "use-credentials" === input ? input : ""; } -var isomorphicReactPackageVersion$jscomp$inline_1772 = React.version; +var isomorphicReactPackageVersion$jscomp$inline_1776 = React.version; if ( - "19.0.0-www-classic-7f217d1d-20240725" !== - isomorphicReactPackageVersion$jscomp$inline_1772 + "19.0.0-www-classic-b9af819f-20240726" !== + isomorphicReactPackageVersion$jscomp$inline_1776 ) throw Error( formatProdErrorMessage( 527, - isomorphicReactPackageVersion$jscomp$inline_1772, - "19.0.0-www-classic-7f217d1d-20240725" + isomorphicReactPackageVersion$jscomp$inline_1776, + "19.0.0-www-classic-b9af819f-20240726" ) ); function flushSyncFromReconciler(fn) { @@ -17285,17 +17344,17 @@ Internals.Events = [ return fn(a); } ]; -var devToolsConfig$jscomp$inline_1779 = { +var devToolsConfig$jscomp$inline_1783 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-classic-7f217d1d-20240725", + version: "19.0.0-www-classic-b9af819f-20240726", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2211 = { - bundleType: devToolsConfig$jscomp$inline_1779.bundleType, - version: devToolsConfig$jscomp$inline_1779.version, - rendererPackageName: devToolsConfig$jscomp$inline_1779.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1779.rendererConfig, +var internals$jscomp$inline_2221 = { + bundleType: devToolsConfig$jscomp$inline_1783.bundleType, + version: devToolsConfig$jscomp$inline_1783.version, + rendererPackageName: devToolsConfig$jscomp$inline_1783.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1783.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -17311,26 +17370,26 @@ var internals$jscomp$inline_2211 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1779.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1783.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-classic-7f217d1d-20240725" + reconcilerVersion: "19.0.0-www-classic-b9af819f-20240726" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2212 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2222 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2212.isDisabled && - hook$jscomp$inline_2212.supportsFiber + !hook$jscomp$inline_2222.isDisabled && + hook$jscomp$inline_2222.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2212.inject( - internals$jscomp$inline_2211 + (rendererID = hook$jscomp$inline_2222.inject( + internals$jscomp$inline_2221 )), - (injectedHook = hook$jscomp$inline_2212); + (injectedHook = hook$jscomp$inline_2222); } catch (err) {} } function ReactDOMRoot(internalRoot) { @@ -17774,4 +17833,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-classic-7f217d1d-20240725"; +exports.version = "19.0.0-www-classic-b9af819f-20240726"; diff --git a/compiled/facebook-www/ReactDOM-prod.modern.js b/compiled/facebook-www/ReactDOM-prod.modern.js index e61d263f973f3..8e3a821a5537c 100644 --- a/compiled/facebook-www/ReactDOM-prod.modern.js +++ b/compiled/facebook-www/ReactDOM-prod.modern.js @@ -3285,6 +3285,29 @@ function updateWorkInProgressHook() { } return workInProgressHook; } +function unstable_useContextWithBailout(context, select) { + if (null === select) return readContext(context); + if (!enableLazyContextPropagation) throw Error(formatProdErrorMessage(248)); + var consumer = currentlyRenderingFiber, + value = context._currentValue; + if (lastFullyObservedContext !== context) + if ( + ((context = { + context: context, + memoizedValue: value, + next: null, + select: select, + lastSelectedValue: select(value) + }), + null === lastContextDependency) + ) { + if (null === consumer) throw Error(formatProdErrorMessage(308)); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + enableLazyContextPropagation && (consumer.flags |= 524288); + } else lastContextDependency = lastContextDependency.next = context; + return value; +} var createFunctionComponentUpdateQueue; createFunctionComponentUpdateQueue = function () { return { lastEffect: null, events: null, stores: null, memoCache: null }; @@ -4242,6 +4265,7 @@ ContextOnlyDispatcher.useHostTransitionStatus = throwInvalidHookError; ContextOnlyDispatcher.useFormState = throwInvalidHookError; ContextOnlyDispatcher.useActionState = throwInvalidHookError; ContextOnlyDispatcher.useOptimistic = throwInvalidHookError; +ContextOnlyDispatcher.unstable_useContextWithBailout = throwInvalidHookError; var HooksDispatcherOnMount = { readContext: readContext, use: use, @@ -4434,6 +4458,8 @@ HooksDispatcherOnMount.useOptimistic = function (passthrough) { queue.dispatch = hook; return [passthrough, hook]; }; +HooksDispatcherOnMount.unstable_useContextWithBailout = + unstable_useContextWithBailout; var HooksDispatcherOnUpdate = { readContext: readContext, use: use, @@ -4482,6 +4508,8 @@ HooksDispatcherOnUpdate.useOptimistic = function (passthrough, reducer) { var hook = updateWorkInProgressHook(); return updateOptimisticImpl(hook, currentHook, passthrough, reducer); }; +HooksDispatcherOnUpdate.unstable_useContextWithBailout = + unstable_useContextWithBailout; var HooksDispatcherOnRerender = { readContext: readContext, use: use, @@ -4535,6 +4563,8 @@ HooksDispatcherOnRerender.useOptimistic = function (passthrough, reducer) { hook.baseState = passthrough; return [passthrough, hook.queue.dispatch]; }; +HooksDispatcherOnRerender.unstable_useContextWithBailout = + unstable_useContextWithBailout; function applyDerivedStateFromProps( workInProgress, ctor, @@ -7012,8 +7042,19 @@ function propagateContextChanges( a: for (; null !== list; ) { var dependency = list; list = fiber; - for (var i = 0; i < contexts.length; i++) + var i = 0; + b: for (; i < contexts.length; i++) if (dependency.context === contexts[i]) { + var select = dependency.select; + if ( + null != select && + null != dependency.lastSelectedValue && + !checkIfSelectedContextValuesChanged( + dependency.lastSelectedValue, + select(dependency.context._currentValue) + ) + ) + continue b; list.lanes |= renderLanes; dependency = list.alternate; null !== dependency && (dependency.lanes |= renderLanes); @@ -7103,6 +7144,17 @@ function propagateParentContextChanges( workInProgress.flags |= 262144; } } +function checkIfSelectedContextValuesChanged( + oldComparedValue, + newComparedValue +) { + if (isArrayImpl(oldComparedValue) && isArrayImpl(newComparedValue)) { + if (oldComparedValue.length !== newComparedValue.length) return !0; + for (var i = 0; i < oldComparedValue.length; i++) + if (!objectIs(newComparedValue[i], oldComparedValue[i])) return !0; + } else throw Error(formatProdErrorMessage(541)); + return !1; +} function checkIfContextChanged(currentDependencies) { if (!enableLazyContextPropagation) return !1; for ( @@ -7110,13 +7162,20 @@ function checkIfContextChanged(currentDependencies) { null !== currentDependencies; ) { + var newValue = currentDependencies.context._currentValue, + oldValue = currentDependencies.memoizedValue; if ( - !objectIs( - currentDependencies.context._currentValue, - currentDependencies.memoizedValue + null != currentDependencies.select && + null != currentDependencies.lastSelectedValue + ) { + if ( + checkIfSelectedContextValuesChanged( + currentDependencies.lastSelectedValue, + currentDependencies.select(newValue) + ) ) - ) - return !0; + return !0; + } else if (!objectIs(newValue, oldValue)) return !0; currentDependencies = currentDependencies.next; } return !1; @@ -12612,19 +12671,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$375; + var JSCompiler_inline_result$jscomp$376; if (canUseDOM) { - var isSupported$jscomp$inline_1529 = "oninput" in document; - if (!isSupported$jscomp$inline_1529) { - var element$jscomp$inline_1530 = document.createElement("div"); - element$jscomp$inline_1530.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1529 = - "function" === typeof element$jscomp$inline_1530.oninput; + var isSupported$jscomp$inline_1533 = "oninput" in document; + if (!isSupported$jscomp$inline_1533) { + var element$jscomp$inline_1534 = document.createElement("div"); + element$jscomp$inline_1534.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1533 = + "function" === typeof element$jscomp$inline_1534.oninput; } - JSCompiler_inline_result$jscomp$375 = isSupported$jscomp$inline_1529; - } else JSCompiler_inline_result$jscomp$375 = !1; + JSCompiler_inline_result$jscomp$376 = isSupported$jscomp$inline_1533; + } else JSCompiler_inline_result$jscomp$376 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$375 && + JSCompiler_inline_result$jscomp$376 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -13035,20 +13094,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1570 = 0; - i$jscomp$inline_1570 < simpleEventPluginEvents.length; - i$jscomp$inline_1570++ + var i$jscomp$inline_1574 = 0; + i$jscomp$inline_1574 < simpleEventPluginEvents.length; + i$jscomp$inline_1574++ ) { - var eventName$jscomp$inline_1571 = - simpleEventPluginEvents[i$jscomp$inline_1570], - domEventName$jscomp$inline_1572 = - eventName$jscomp$inline_1571.toLowerCase(), - capitalizedEvent$jscomp$inline_1573 = - eventName$jscomp$inline_1571[0].toUpperCase() + - eventName$jscomp$inline_1571.slice(1); + var eventName$jscomp$inline_1575 = + simpleEventPluginEvents[i$jscomp$inline_1574], + domEventName$jscomp$inline_1576 = + eventName$jscomp$inline_1575.toLowerCase(), + capitalizedEvent$jscomp$inline_1577 = + eventName$jscomp$inline_1575[0].toUpperCase() + + eventName$jscomp$inline_1575.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1572, - "on" + capitalizedEvent$jscomp$inline_1573 + domEventName$jscomp$inline_1576, + "on" + capitalizedEvent$jscomp$inline_1577 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -16598,16 +16657,16 @@ function getCrossOriginStringAs(as, input) { if ("string" === typeof input) return "use-credentials" === input ? input : ""; } -var isomorphicReactPackageVersion$jscomp$inline_1743 = React.version; +var isomorphicReactPackageVersion$jscomp$inline_1747 = React.version; if ( - "19.0.0-www-modern-7f217d1d-20240725" !== - isomorphicReactPackageVersion$jscomp$inline_1743 + "19.0.0-www-modern-b9af819f-20240726" !== + isomorphicReactPackageVersion$jscomp$inline_1747 ) throw Error( formatProdErrorMessage( 527, - isomorphicReactPackageVersion$jscomp$inline_1743, - "19.0.0-www-modern-7f217d1d-20240725" + isomorphicReactPackageVersion$jscomp$inline_1747, + "19.0.0-www-modern-b9af819f-20240726" ) ); Internals.findDOMNode = function (componentOrElement) { @@ -16623,17 +16682,17 @@ Internals.Events = [ return fn(a); } ]; -var devToolsConfig$jscomp$inline_1745 = { +var devToolsConfig$jscomp$inline_1749 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-modern-7f217d1d-20240725", + version: "19.0.0-www-modern-b9af819f-20240726", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2202 = { - bundleType: devToolsConfig$jscomp$inline_1745.bundleType, - version: devToolsConfig$jscomp$inline_1745.version, - rendererPackageName: devToolsConfig$jscomp$inline_1745.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1745.rendererConfig, +var internals$jscomp$inline_2212 = { + bundleType: devToolsConfig$jscomp$inline_1749.bundleType, + version: devToolsConfig$jscomp$inline_1749.version, + rendererPackageName: devToolsConfig$jscomp$inline_1749.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1749.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -16649,26 +16708,26 @@ var internals$jscomp$inline_2202 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1745.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1749.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-modern-7f217d1d-20240725" + reconcilerVersion: "19.0.0-www-modern-b9af819f-20240726" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2203 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2213 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2203.isDisabled && - hook$jscomp$inline_2203.supportsFiber + !hook$jscomp$inline_2213.isDisabled && + hook$jscomp$inline_2213.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2203.inject( - internals$jscomp$inline_2202 + (rendererID = hook$jscomp$inline_2213.inject( + internals$jscomp$inline_2212 )), - (injectedHook = hook$jscomp$inline_2203); + (injectedHook = hook$jscomp$inline_2213); } catch (err) {} } function ReactDOMRoot(internalRoot) { @@ -17019,4 +17078,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-modern-7f217d1d-20240725"; +exports.version = "19.0.0-www-modern-b9af819f-20240726"; diff --git a/compiled/facebook-www/ReactDOM-profiling.classic.js b/compiled/facebook-www/ReactDOM-profiling.classic.js index 65a8662862794..b5d8476198d35 100644 --- a/compiled/facebook-www/ReactDOM-profiling.classic.js +++ b/compiled/facebook-www/ReactDOM-profiling.classic.js @@ -3586,6 +3586,29 @@ function updateWorkInProgressHook() { } return workInProgressHook; } +function unstable_useContextWithBailout(context, select) { + if (null === select) return readContext(context); + if (!enableLazyContextPropagation) throw Error(formatProdErrorMessage(248)); + var consumer = currentlyRenderingFiber, + value = context._currentValue; + if (lastFullyObservedContext !== context) + if ( + ((context = { + context: context, + memoizedValue: value, + next: null, + select: select, + lastSelectedValue: select(value) + }), + null === lastContextDependency) + ) { + if (null === consumer) throw Error(formatProdErrorMessage(308)); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + enableLazyContextPropagation && (consumer.flags |= 524288); + } else lastContextDependency = lastContextDependency.next = context; + return value; +} var createFunctionComponentUpdateQueue; createFunctionComponentUpdateQueue = function () { return { lastEffect: null, events: null, stores: null, memoCache: null }; @@ -4546,6 +4569,7 @@ ContextOnlyDispatcher.useHostTransitionStatus = throwInvalidHookError; ContextOnlyDispatcher.useFormState = throwInvalidHookError; ContextOnlyDispatcher.useActionState = throwInvalidHookError; ContextOnlyDispatcher.useOptimistic = throwInvalidHookError; +ContextOnlyDispatcher.unstable_useContextWithBailout = throwInvalidHookError; var HooksDispatcherOnMount = { readContext: readContext, use: use, @@ -4738,6 +4762,8 @@ HooksDispatcherOnMount.useOptimistic = function (passthrough) { queue.dispatch = hook; return [passthrough, hook]; }; +HooksDispatcherOnMount.unstable_useContextWithBailout = + unstable_useContextWithBailout; var HooksDispatcherOnUpdate = { readContext: readContext, use: use, @@ -4786,6 +4812,8 @@ HooksDispatcherOnUpdate.useOptimistic = function (passthrough, reducer) { var hook = updateWorkInProgressHook(); return updateOptimisticImpl(hook, currentHook, passthrough, reducer); }; +HooksDispatcherOnUpdate.unstable_useContextWithBailout = + unstable_useContextWithBailout; var HooksDispatcherOnRerender = { readContext: readContext, use: use, @@ -4839,6 +4867,8 @@ HooksDispatcherOnRerender.useOptimistic = function (passthrough, reducer) { hook.baseState = passthrough; return [passthrough, hook.queue.dispatch]; }; +HooksDispatcherOnRerender.unstable_useContextWithBailout = + unstable_useContextWithBailout; var now = Scheduler.unstable_now, commitTime = 0, layoutEffectStartTime = -1, @@ -7677,8 +7707,19 @@ function propagateContextChanges( a: for (; null !== list; ) { var dependency = list; list = fiber; - for (var i = 0; i < contexts.length; i++) + var i = 0; + b: for (; i < contexts.length; i++) if (dependency.context === contexts[i]) { + var select = dependency.select; + if ( + null != select && + null != dependency.lastSelectedValue && + !checkIfSelectedContextValuesChanged( + dependency.lastSelectedValue, + select(dependency.context._currentValue) + ) + ) + continue b; list.lanes |= renderLanes; dependency = list.alternate; null !== dependency && (dependency.lanes |= renderLanes); @@ -7768,6 +7809,17 @@ function propagateParentContextChanges( workInProgress.flags |= 262144; } } +function checkIfSelectedContextValuesChanged( + oldComparedValue, + newComparedValue +) { + if (isArrayImpl(oldComparedValue) && isArrayImpl(newComparedValue)) { + if (oldComparedValue.length !== newComparedValue.length) return !0; + for (var i = 0; i < oldComparedValue.length; i++) + if (!objectIs(newComparedValue[i], oldComparedValue[i])) return !0; + } else throw Error(formatProdErrorMessage(541)); + return !1; +} function checkIfContextChanged(currentDependencies) { if (!enableLazyContextPropagation) return !1; for ( @@ -7775,13 +7827,20 @@ function checkIfContextChanged(currentDependencies) { null !== currentDependencies; ) { + var newValue = currentDependencies.context._currentValue, + oldValue = currentDependencies.memoizedValue; if ( - !objectIs( - currentDependencies.context._currentValue, - currentDependencies.memoizedValue + null != currentDependencies.select && + null != currentDependencies.lastSelectedValue + ) { + if ( + checkIfSelectedContextValuesChanged( + currentDependencies.lastSelectedValue, + currentDependencies.select(newValue) + ) ) - ) - return !0; + return !0; + } else if (!objectIs(newValue, oldValue)) return !0; currentDependencies = currentDependencies.next; } return !1; @@ -13971,19 +14030,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$410; + var JSCompiler_inline_result$jscomp$411; if (canUseDOM) { - var isSupported$jscomp$inline_1646 = "oninput" in document; - if (!isSupported$jscomp$inline_1646) { - var element$jscomp$inline_1647 = document.createElement("div"); - element$jscomp$inline_1647.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1646 = - "function" === typeof element$jscomp$inline_1647.oninput; + var isSupported$jscomp$inline_1650 = "oninput" in document; + if (!isSupported$jscomp$inline_1650) { + var element$jscomp$inline_1651 = document.createElement("div"); + element$jscomp$inline_1651.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1650 = + "function" === typeof element$jscomp$inline_1651.oninput; } - JSCompiler_inline_result$jscomp$410 = isSupported$jscomp$inline_1646; - } else JSCompiler_inline_result$jscomp$410 = !1; + JSCompiler_inline_result$jscomp$411 = isSupported$jscomp$inline_1650; + } else JSCompiler_inline_result$jscomp$411 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$410 && + JSCompiler_inline_result$jscomp$411 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -14394,20 +14453,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1687 = 0; - i$jscomp$inline_1687 < simpleEventPluginEvents.length; - i$jscomp$inline_1687++ + var i$jscomp$inline_1691 = 0; + i$jscomp$inline_1691 < simpleEventPluginEvents.length; + i$jscomp$inline_1691++ ) { - var eventName$jscomp$inline_1688 = - simpleEventPluginEvents[i$jscomp$inline_1687], - domEventName$jscomp$inline_1689 = - eventName$jscomp$inline_1688.toLowerCase(), - capitalizedEvent$jscomp$inline_1690 = - eventName$jscomp$inline_1688[0].toUpperCase() + - eventName$jscomp$inline_1688.slice(1); + var eventName$jscomp$inline_1692 = + simpleEventPluginEvents[i$jscomp$inline_1691], + domEventName$jscomp$inline_1693 = + eventName$jscomp$inline_1692.toLowerCase(), + capitalizedEvent$jscomp$inline_1694 = + eventName$jscomp$inline_1692[0].toUpperCase() + + eventName$jscomp$inline_1692.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1689, - "on" + capitalizedEvent$jscomp$inline_1690 + domEventName$jscomp$inline_1693, + "on" + capitalizedEvent$jscomp$inline_1694 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -18008,16 +18067,16 @@ function getCrossOriginStringAs(as, input) { if ("string" === typeof input) return "use-credentials" === input ? input : ""; } -var isomorphicReactPackageVersion$jscomp$inline_1860 = React.version; +var isomorphicReactPackageVersion$jscomp$inline_1864 = React.version; if ( - "19.0.0-www-classic-7f217d1d-20240725" !== - isomorphicReactPackageVersion$jscomp$inline_1860 + "19.0.0-www-classic-b9af819f-20240726" !== + isomorphicReactPackageVersion$jscomp$inline_1864 ) throw Error( formatProdErrorMessage( 527, - isomorphicReactPackageVersion$jscomp$inline_1860, - "19.0.0-www-classic-7f217d1d-20240725" + isomorphicReactPackageVersion$jscomp$inline_1864, + "19.0.0-www-classic-b9af819f-20240726" ) ); function flushSyncFromReconciler(fn) { @@ -18060,10 +18119,10 @@ Internals.Events = [ return fn(a); } ]; -var devToolsConfig$jscomp$inline_1867 = { +var devToolsConfig$jscomp$inline_1871 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-classic-7f217d1d-20240725", + version: "19.0.0-www-classic-b9af819f-20240726", rendererPackageName: "react-dom" }; (function (internals) { @@ -18081,10 +18140,10 @@ var devToolsConfig$jscomp$inline_1867 = { } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1867.bundleType, - version: devToolsConfig$jscomp$inline_1867.version, - rendererPackageName: devToolsConfig$jscomp$inline_1867.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1867.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1871.bundleType, + version: devToolsConfig$jscomp$inline_1871.version, + rendererPackageName: devToolsConfig$jscomp$inline_1871.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1871.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -18100,14 +18159,14 @@ var devToolsConfig$jscomp$inline_1867 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1867.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1871.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-classic-7f217d1d-20240725" + reconcilerVersion: "19.0.0-www-classic-b9af819f-20240726" }); function ReactDOMRoot(internalRoot) { this._internalRoot = internalRoot; @@ -18550,7 +18609,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-classic-7f217d1d-20240725"; +exports.version = "19.0.0-www-classic-b9af819f-20240726"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled/facebook-www/ReactDOM-profiling.modern.js b/compiled/facebook-www/ReactDOM-profiling.modern.js index f4feb0b4a4c19..a816287e78b8b 100644 --- a/compiled/facebook-www/ReactDOM-profiling.modern.js +++ b/compiled/facebook-www/ReactDOM-profiling.modern.js @@ -3421,6 +3421,29 @@ function updateWorkInProgressHook() { } return workInProgressHook; } +function unstable_useContextWithBailout(context, select) { + if (null === select) return readContext(context); + if (!enableLazyContextPropagation) throw Error(formatProdErrorMessage(248)); + var consumer = currentlyRenderingFiber, + value = context._currentValue; + if (lastFullyObservedContext !== context) + if ( + ((context = { + context: context, + memoizedValue: value, + next: null, + select: select, + lastSelectedValue: select(value) + }), + null === lastContextDependency) + ) { + if (null === consumer) throw Error(formatProdErrorMessage(308)); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + enableLazyContextPropagation && (consumer.flags |= 524288); + } else lastContextDependency = lastContextDependency.next = context; + return value; +} var createFunctionComponentUpdateQueue; createFunctionComponentUpdateQueue = function () { return { lastEffect: null, events: null, stores: null, memoCache: null }; @@ -4381,6 +4404,7 @@ ContextOnlyDispatcher.useHostTransitionStatus = throwInvalidHookError; ContextOnlyDispatcher.useFormState = throwInvalidHookError; ContextOnlyDispatcher.useActionState = throwInvalidHookError; ContextOnlyDispatcher.useOptimistic = throwInvalidHookError; +ContextOnlyDispatcher.unstable_useContextWithBailout = throwInvalidHookError; var HooksDispatcherOnMount = { readContext: readContext, use: use, @@ -4573,6 +4597,8 @@ HooksDispatcherOnMount.useOptimistic = function (passthrough) { queue.dispatch = hook; return [passthrough, hook]; }; +HooksDispatcherOnMount.unstable_useContextWithBailout = + unstable_useContextWithBailout; var HooksDispatcherOnUpdate = { readContext: readContext, use: use, @@ -4621,6 +4647,8 @@ HooksDispatcherOnUpdate.useOptimistic = function (passthrough, reducer) { var hook = updateWorkInProgressHook(); return updateOptimisticImpl(hook, currentHook, passthrough, reducer); }; +HooksDispatcherOnUpdate.unstable_useContextWithBailout = + unstable_useContextWithBailout; var HooksDispatcherOnRerender = { readContext: readContext, use: use, @@ -4674,6 +4702,8 @@ HooksDispatcherOnRerender.useOptimistic = function (passthrough, reducer) { hook.baseState = passthrough; return [passthrough, hook.queue.dispatch]; }; +HooksDispatcherOnRerender.unstable_useContextWithBailout = + unstable_useContextWithBailout; var now = Scheduler.unstable_now, commitTime = 0, layoutEffectStartTime = -1, @@ -7243,8 +7273,19 @@ function propagateContextChanges( a: for (; null !== list; ) { var dependency = list; list = fiber; - for (var i = 0; i < contexts.length; i++) + var i = 0; + b: for (; i < contexts.length; i++) if (dependency.context === contexts[i]) { + var select = dependency.select; + if ( + null != select && + null != dependency.lastSelectedValue && + !checkIfSelectedContextValuesChanged( + dependency.lastSelectedValue, + select(dependency.context._currentValue) + ) + ) + continue b; list.lanes |= renderLanes; dependency = list.alternate; null !== dependency && (dependency.lanes |= renderLanes); @@ -7334,6 +7375,17 @@ function propagateParentContextChanges( workInProgress.flags |= 262144; } } +function checkIfSelectedContextValuesChanged( + oldComparedValue, + newComparedValue +) { + if (isArrayImpl(oldComparedValue) && isArrayImpl(newComparedValue)) { + if (oldComparedValue.length !== newComparedValue.length) return !0; + for (var i = 0; i < oldComparedValue.length; i++) + if (!objectIs(newComparedValue[i], oldComparedValue[i])) return !0; + } else throw Error(formatProdErrorMessage(541)); + return !1; +} function checkIfContextChanged(currentDependencies) { if (!enableLazyContextPropagation) return !1; for ( @@ -7341,13 +7393,20 @@ function checkIfContextChanged(currentDependencies) { null !== currentDependencies; ) { + var newValue = currentDependencies.context._currentValue, + oldValue = currentDependencies.memoizedValue; if ( - !objectIs( - currentDependencies.context._currentValue, - currentDependencies.memoizedValue + null != currentDependencies.select && + null != currentDependencies.lastSelectedValue + ) { + if ( + checkIfSelectedContextValuesChanged( + currentDependencies.lastSelectedValue, + currentDependencies.select(newValue) + ) ) - ) - return !0; + return !0; + } else if (!objectIs(newValue, oldValue)) return !0; currentDependencies = currentDependencies.next; } return !1; @@ -13370,19 +13429,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$397; + var JSCompiler_inline_result$jscomp$398; if (canUseDOM) { - var isSupported$jscomp$inline_1617 = "oninput" in document; - if (!isSupported$jscomp$inline_1617) { - var element$jscomp$inline_1618 = document.createElement("div"); - element$jscomp$inline_1618.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1617 = - "function" === typeof element$jscomp$inline_1618.oninput; + var isSupported$jscomp$inline_1621 = "oninput" in document; + if (!isSupported$jscomp$inline_1621) { + var element$jscomp$inline_1622 = document.createElement("div"); + element$jscomp$inline_1622.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1621 = + "function" === typeof element$jscomp$inline_1622.oninput; } - JSCompiler_inline_result$jscomp$397 = isSupported$jscomp$inline_1617; - } else JSCompiler_inline_result$jscomp$397 = !1; + JSCompiler_inline_result$jscomp$398 = isSupported$jscomp$inline_1621; + } else JSCompiler_inline_result$jscomp$398 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$397 && + JSCompiler_inline_result$jscomp$398 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -13793,20 +13852,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1658 = 0; - i$jscomp$inline_1658 < simpleEventPluginEvents.length; - i$jscomp$inline_1658++ + var i$jscomp$inline_1662 = 0; + i$jscomp$inline_1662 < simpleEventPluginEvents.length; + i$jscomp$inline_1662++ ) { - var eventName$jscomp$inline_1659 = - simpleEventPluginEvents[i$jscomp$inline_1658], - domEventName$jscomp$inline_1660 = - eventName$jscomp$inline_1659.toLowerCase(), - capitalizedEvent$jscomp$inline_1661 = - eventName$jscomp$inline_1659[0].toUpperCase() + - eventName$jscomp$inline_1659.slice(1); + var eventName$jscomp$inline_1663 = + simpleEventPluginEvents[i$jscomp$inline_1662], + domEventName$jscomp$inline_1664 = + eventName$jscomp$inline_1663.toLowerCase(), + capitalizedEvent$jscomp$inline_1665 = + eventName$jscomp$inline_1663[0].toUpperCase() + + eventName$jscomp$inline_1663.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1660, - "on" + capitalizedEvent$jscomp$inline_1661 + domEventName$jscomp$inline_1664, + "on" + capitalizedEvent$jscomp$inline_1665 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -17356,16 +17415,16 @@ function getCrossOriginStringAs(as, input) { if ("string" === typeof input) return "use-credentials" === input ? input : ""; } -var isomorphicReactPackageVersion$jscomp$inline_1831 = React.version; +var isomorphicReactPackageVersion$jscomp$inline_1835 = React.version; if ( - "19.0.0-www-modern-7f217d1d-20240725" !== - isomorphicReactPackageVersion$jscomp$inline_1831 + "19.0.0-www-modern-b9af819f-20240726" !== + isomorphicReactPackageVersion$jscomp$inline_1835 ) throw Error( formatProdErrorMessage( 527, - isomorphicReactPackageVersion$jscomp$inline_1831, - "19.0.0-www-modern-7f217d1d-20240725" + isomorphicReactPackageVersion$jscomp$inline_1835, + "19.0.0-www-modern-b9af819f-20240726" ) ); Internals.findDOMNode = function (componentOrElement) { @@ -17381,10 +17440,10 @@ Internals.Events = [ return fn(a); } ]; -var devToolsConfig$jscomp$inline_1833 = { +var devToolsConfig$jscomp$inline_1837 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-modern-7f217d1d-20240725", + version: "19.0.0-www-modern-b9af819f-20240726", rendererPackageName: "react-dom" }; (function (internals) { @@ -17402,10 +17461,10 @@ var devToolsConfig$jscomp$inline_1833 = { } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1833.bundleType, - version: devToolsConfig$jscomp$inline_1833.version, - rendererPackageName: devToolsConfig$jscomp$inline_1833.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1833.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1837.bundleType, + version: devToolsConfig$jscomp$inline_1837.version, + rendererPackageName: devToolsConfig$jscomp$inline_1837.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1837.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -17421,14 +17480,14 @@ var devToolsConfig$jscomp$inline_1833 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1833.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1837.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-modern-7f217d1d-20240725" + reconcilerVersion: "19.0.0-www-modern-b9af819f-20240726" }); function ReactDOMRoot(internalRoot) { this._internalRoot = internalRoot; @@ -17778,7 +17837,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-modern-7f217d1d-20240725"; +exports.version = "19.0.0-www-modern-b9af819f-20240726"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled/facebook-www/ReactDOMServer-dev.classic.js b/compiled/facebook-www/ReactDOMServer-dev.classic.js index 514ed2eb12532..be02d7ce13c90 100644 --- a/compiled/facebook-www/ReactDOMServer-dev.classic.js +++ b/compiled/facebook-www/ReactDOMServer-dev.classic.js @@ -8873,5 +8873,5 @@ __DEV__ && 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; - exports.version = "19.0.0-www-classic-7f217d1d-20240725"; + exports.version = "19.0.0-www-classic-b9af819f-20240726"; })(); diff --git a/compiled/facebook-www/ReactDOMServer-dev.modern.js b/compiled/facebook-www/ReactDOMServer-dev.modern.js index cb9c1b4960048..6b787d5381ca2 100644 --- a/compiled/facebook-www/ReactDOMServer-dev.modern.js +++ b/compiled/facebook-www/ReactDOMServer-dev.modern.js @@ -8698,5 +8698,5 @@ __DEV__ && 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; - exports.version = "19.0.0-www-modern-7f217d1d-20240725"; + exports.version = "19.0.0-www-modern-b9af819f-20240726"; })(); diff --git a/compiled/facebook-www/ReactDOMServer-prod.classic.js b/compiled/facebook-www/ReactDOMServer-prod.classic.js index 98012a3def46c..aab27aea8909d 100644 --- a/compiled/facebook-www/ReactDOMServer-prod.classic.js +++ b/compiled/facebook-www/ReactDOMServer-prod.classic.js @@ -5797,4 +5797,4 @@ exports.renderToString = function (children, options) { 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; -exports.version = "19.0.0-www-classic-7f217d1d-20240725"; +exports.version = "19.0.0-www-classic-b9af819f-20240726"; diff --git a/compiled/facebook-www/ReactDOMServer-prod.modern.js b/compiled/facebook-www/ReactDOMServer-prod.modern.js index 1e8b1b3223548..f472d7cbf2e74 100644 --- a/compiled/facebook-www/ReactDOMServer-prod.modern.js +++ b/compiled/facebook-www/ReactDOMServer-prod.modern.js @@ -5724,4 +5724,4 @@ exports.renderToString = function (children, options) { 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; -exports.version = "19.0.0-www-modern-7f217d1d-20240725"; +exports.version = "19.0.0-www-modern-b9af819f-20240726"; diff --git a/compiled/facebook-www/ReactDOMTesting-dev.classic.js b/compiled/facebook-www/ReactDOMTesting-dev.classic.js index 3afb6efd96bad..5af122ca760cc 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.classic.js @@ -6014,6 +6014,32 @@ __DEV__ && } return workInProgressHook; } + function unstable_useContextWithBailout(context, select) { + if (null === select) return readContext(context); + if (!enableLazyContextPropagation) throw Error("Not implemented."); + var consumer = currentlyRenderingFiber, + value = context._currentValue; + if (lastFullyObservedContext !== context) + if ( + ((context = { + context: context, + memoizedValue: value, + next: null, + select: select, + lastSelectedValue: select(value) + }), + null === lastContextDependency) + ) { + if (null === consumer) + throw Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + enableLazyContextPropagation && (consumer.flags |= 524288); + } else lastContextDependency = lastContextDependency.next = context; + return value; + } function useThenable(thenable) { var index = thenableIndexCounter; thenableIndexCounter += 1; @@ -9213,32 +9239,32 @@ __DEV__ && return current; } function updateSuspenseComponent(current, workInProgress, renderLanes) { - var JSCompiler_object_inline_digest_2474; - var JSCompiler_object_inline_stack_2475 = workInProgress.pendingProps; + var JSCompiler_object_inline_digest_2484; + var JSCompiler_object_inline_stack_2485 = workInProgress.pendingProps; shouldSuspendImpl(workInProgress) && (workInProgress.flags |= 128); - var JSCompiler_object_inline_componentStack_2476 = !1; + var JSCompiler_object_inline_componentStack_2486 = !1; var didSuspend = 0 !== (workInProgress.flags & 128); - (JSCompiler_object_inline_digest_2474 = didSuspend) || - (JSCompiler_object_inline_digest_2474 = + (JSCompiler_object_inline_digest_2484 = didSuspend) || + (JSCompiler_object_inline_digest_2484 = null !== current && null === current.memoizedState ? !1 : 0 !== (suspenseStackCursor.current & ForceSuspenseFallback)); - JSCompiler_object_inline_digest_2474 && - ((JSCompiler_object_inline_componentStack_2476 = !0), + JSCompiler_object_inline_digest_2484 && + ((JSCompiler_object_inline_componentStack_2486 = !0), (workInProgress.flags &= -129)); - JSCompiler_object_inline_digest_2474 = 0 !== (workInProgress.flags & 32); + JSCompiler_object_inline_digest_2484 = 0 !== (workInProgress.flags & 32); workInProgress.flags &= -33; if (null === current) { if (isHydrating) { - JSCompiler_object_inline_componentStack_2476 + JSCompiler_object_inline_componentStack_2486 ? pushPrimaryTreeSuspenseHandler(workInProgress) : reuseSuspenseHandlerOnStack(workInProgress); if (isHydrating) { - var JSCompiler_object_inline_message_2473 = nextHydratableInstance; + var JSCompiler_object_inline_message_2483 = nextHydratableInstance; var JSCompiler_temp; - if (!(JSCompiler_temp = !JSCompiler_object_inline_message_2473)) { + if (!(JSCompiler_temp = !JSCompiler_object_inline_message_2483)) { c: { - var instance = JSCompiler_object_inline_message_2473; + var instance = JSCompiler_object_inline_message_2483; for ( JSCompiler_temp = rootOrSingletonContext; instance.nodeType !== COMMENT_NODE; @@ -9279,19 +9305,19 @@ __DEV__ && JSCompiler_temp && (warnNonHydratedInstance( workInProgress, - JSCompiler_object_inline_message_2473 + JSCompiler_object_inline_message_2483 ), throwOnHydrationMismatch(workInProgress)); } - JSCompiler_object_inline_message_2473 = workInProgress.memoizedState; + JSCompiler_object_inline_message_2483 = workInProgress.memoizedState; if ( - null !== JSCompiler_object_inline_message_2473 && - ((JSCompiler_object_inline_message_2473 = - JSCompiler_object_inline_message_2473.dehydrated), - null !== JSCompiler_object_inline_message_2473) + null !== JSCompiler_object_inline_message_2483 && + ((JSCompiler_object_inline_message_2483 = + JSCompiler_object_inline_message_2483.dehydrated), + null !== JSCompiler_object_inline_message_2483) ) return ( - JSCompiler_object_inline_message_2473.data === + JSCompiler_object_inline_message_2483.data === SUSPENSE_FALLBACK_START_DATA ? (workInProgress.lanes = DefaultHydrationLane) : (workInProgress.lanes = OffscreenLane), @@ -9299,27 +9325,27 @@ __DEV__ && ); popSuspenseHandler(workInProgress); } - JSCompiler_object_inline_message_2473 = - JSCompiler_object_inline_stack_2475.children; - JSCompiler_temp = JSCompiler_object_inline_stack_2475.fallback; - if (JSCompiler_object_inline_componentStack_2476) + JSCompiler_object_inline_message_2483 = + JSCompiler_object_inline_stack_2485.children; + JSCompiler_temp = JSCompiler_object_inline_stack_2485.fallback; + if (JSCompiler_object_inline_componentStack_2486) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_stack_2475 = + (JSCompiler_object_inline_stack_2485 = mountSuspenseFallbackChildren( workInProgress, - JSCompiler_object_inline_message_2473, + JSCompiler_object_inline_message_2483, JSCompiler_temp, renderLanes )), - (JSCompiler_object_inline_componentStack_2476 = + (JSCompiler_object_inline_componentStack_2486 = workInProgress.child), - (JSCompiler_object_inline_componentStack_2476.memoizedState = + (JSCompiler_object_inline_componentStack_2486.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_componentStack_2476.childLanes = + (JSCompiler_object_inline_componentStack_2486.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2474, + JSCompiler_object_inline_digest_2484, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), @@ -9332,9 +9358,9 @@ __DEV__ && ? markerInstanceStack.current : null), (current = - JSCompiler_object_inline_componentStack_2476.updateQueue), + JSCompiler_object_inline_componentStack_2486.updateQueue), null === current - ? (JSCompiler_object_inline_componentStack_2476.updateQueue = + ? (JSCompiler_object_inline_componentStack_2486.updateQueue = { transitions: workInProgress, markerInstances: renderLanes, @@ -9342,46 +9368,46 @@ __DEV__ && }) : ((current.transitions = workInProgress), (current.markerInstances = renderLanes)))), - JSCompiler_object_inline_stack_2475 + JSCompiler_object_inline_stack_2485 ); if ( "number" === - typeof JSCompiler_object_inline_stack_2475.unstable_expectedLoadTime + typeof JSCompiler_object_inline_stack_2485.unstable_expectedLoadTime ) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_stack_2475 = + (JSCompiler_object_inline_stack_2485 = mountSuspenseFallbackChildren( workInProgress, - JSCompiler_object_inline_message_2473, + JSCompiler_object_inline_message_2483, JSCompiler_temp, renderLanes )), - (JSCompiler_object_inline_componentStack_2476 = + (JSCompiler_object_inline_componentStack_2486 = workInProgress.child), - (JSCompiler_object_inline_componentStack_2476.memoizedState = + (JSCompiler_object_inline_componentStack_2486.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_componentStack_2476.childLanes = + (JSCompiler_object_inline_componentStack_2486.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2474, + JSCompiler_object_inline_digest_2484, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress.lanes = 4194304), - JSCompiler_object_inline_stack_2475 + JSCompiler_object_inline_stack_2485 ); pushPrimaryTreeSuspenseHandler(workInProgress); return mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_message_2473 + JSCompiler_object_inline_message_2483 ); } var prevState = current.memoizedState; if ( null !== prevState && - ((JSCompiler_object_inline_message_2473 = prevState.dehydrated), - null !== JSCompiler_object_inline_message_2473) + ((JSCompiler_object_inline_message_2483 = prevState.dehydrated), + null !== JSCompiler_object_inline_message_2483) ) { if (didSuspend) workInProgress.flags & 256 @@ -9398,32 +9424,32 @@ __DEV__ && (workInProgress.flags |= 128), (workInProgress = null)) : (reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_componentStack_2476 = - JSCompiler_object_inline_stack_2475.fallback), - (JSCompiler_object_inline_message_2473 = workInProgress.mode), - (JSCompiler_object_inline_stack_2475 = createFiberFromOffscreen( + (JSCompiler_object_inline_componentStack_2486 = + JSCompiler_object_inline_stack_2485.fallback), + (JSCompiler_object_inline_message_2483 = workInProgress.mode), + (JSCompiler_object_inline_stack_2485 = createFiberFromOffscreen( { mode: "visible", - children: JSCompiler_object_inline_stack_2475.children + children: JSCompiler_object_inline_stack_2485.children }, - JSCompiler_object_inline_message_2473, + JSCompiler_object_inline_message_2483, 0, null )), - (JSCompiler_object_inline_componentStack_2476 = + (JSCompiler_object_inline_componentStack_2486 = createFiberFromFragment( - JSCompiler_object_inline_componentStack_2476, - JSCompiler_object_inline_message_2473, + JSCompiler_object_inline_componentStack_2486, + JSCompiler_object_inline_message_2483, renderLanes, null )), - (JSCompiler_object_inline_componentStack_2476.flags |= 2), - (JSCompiler_object_inline_stack_2475.return = workInProgress), - (JSCompiler_object_inline_componentStack_2476.return = + (JSCompiler_object_inline_componentStack_2486.flags |= 2), + (JSCompiler_object_inline_stack_2485.return = workInProgress), + (JSCompiler_object_inline_componentStack_2486.return = workInProgress), - (JSCompiler_object_inline_stack_2475.sibling = - JSCompiler_object_inline_componentStack_2476), - (workInProgress.child = JSCompiler_object_inline_stack_2475), + (JSCompiler_object_inline_stack_2485.sibling = + JSCompiler_object_inline_componentStack_2486), + (workInProgress.child = JSCompiler_object_inline_stack_2485), (disableLegacyMode || (workInProgress.mode & ConcurrentMode) !== NoMode) && reconcileChildFibers( @@ -9432,63 +9458,63 @@ __DEV__ && null, renderLanes ), - (JSCompiler_object_inline_stack_2475 = workInProgress.child), - (JSCompiler_object_inline_stack_2475.memoizedState = + (JSCompiler_object_inline_stack_2485 = workInProgress.child), + (JSCompiler_object_inline_stack_2485.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_stack_2475.childLanes = + (JSCompiler_object_inline_stack_2485.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2474, + JSCompiler_object_inline_digest_2484, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress = - JSCompiler_object_inline_componentStack_2476)); + JSCompiler_object_inline_componentStack_2486)); else if ( (pushPrimaryTreeSuspenseHandler(workInProgress), isHydrating && error$jscomp$0( "We should not be hydrating here. This is a bug in React. Please file a bug." ), - JSCompiler_object_inline_message_2473.data === + JSCompiler_object_inline_message_2483.data === SUSPENSE_FALLBACK_START_DATA) ) { - JSCompiler_object_inline_digest_2474 = - JSCompiler_object_inline_message_2473.nextSibling && - JSCompiler_object_inline_message_2473.nextSibling.dataset; - if (JSCompiler_object_inline_digest_2474) { - JSCompiler_temp = JSCompiler_object_inline_digest_2474.dgst; - var message = JSCompiler_object_inline_digest_2474.msg; - instance = JSCompiler_object_inline_digest_2474.stck; - var componentStack = JSCompiler_object_inline_digest_2474.cstck; + JSCompiler_object_inline_digest_2484 = + JSCompiler_object_inline_message_2483.nextSibling && + JSCompiler_object_inline_message_2483.nextSibling.dataset; + if (JSCompiler_object_inline_digest_2484) { + JSCompiler_temp = JSCompiler_object_inline_digest_2484.dgst; + var message = JSCompiler_object_inline_digest_2484.msg; + instance = JSCompiler_object_inline_digest_2484.stck; + var componentStack = JSCompiler_object_inline_digest_2484.cstck; } - JSCompiler_object_inline_message_2473 = message; - JSCompiler_object_inline_digest_2474 = JSCompiler_temp; - JSCompiler_object_inline_stack_2475 = instance; - JSCompiler_object_inline_componentStack_2476 = componentStack; - JSCompiler_object_inline_message_2473 = - JSCompiler_object_inline_message_2473 - ? Error(JSCompiler_object_inline_message_2473) + JSCompiler_object_inline_message_2483 = message; + JSCompiler_object_inline_digest_2484 = JSCompiler_temp; + JSCompiler_object_inline_stack_2485 = instance; + JSCompiler_object_inline_componentStack_2486 = componentStack; + JSCompiler_object_inline_message_2483 = + JSCompiler_object_inline_message_2483 + ? Error(JSCompiler_object_inline_message_2483) : Error( "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." ); - JSCompiler_object_inline_message_2473.stack = - JSCompiler_object_inline_stack_2475 || ""; - JSCompiler_object_inline_message_2473.digest = - JSCompiler_object_inline_digest_2474; - JSCompiler_object_inline_digest_2474 = - void 0 === JSCompiler_object_inline_componentStack_2476 + JSCompiler_object_inline_message_2483.stack = + JSCompiler_object_inline_stack_2485 || ""; + JSCompiler_object_inline_message_2483.digest = + JSCompiler_object_inline_digest_2484; + JSCompiler_object_inline_digest_2484 = + void 0 === JSCompiler_object_inline_componentStack_2486 ? null - : JSCompiler_object_inline_componentStack_2476; - "string" === typeof JSCompiler_object_inline_digest_2474 && + : JSCompiler_object_inline_componentStack_2486; + "string" === typeof JSCompiler_object_inline_digest_2484 && CapturedStacks.set( - JSCompiler_object_inline_message_2473, - JSCompiler_object_inline_digest_2474 + JSCompiler_object_inline_message_2483, + JSCompiler_object_inline_digest_2484 ); queueHydrationError({ - value: JSCompiler_object_inline_message_2473, + value: JSCompiler_object_inline_message_2483, source: null, - stack: JSCompiler_object_inline_digest_2474 + stack: JSCompiler_object_inline_digest_2484 }); workInProgress = retrySuspenseComponentWithoutHydrating( current, @@ -9504,26 +9530,26 @@ __DEV__ && renderLanes, !1 ), - (JSCompiler_object_inline_digest_2474 = + (JSCompiler_object_inline_digest_2484 = 0 !== (renderLanes & current.childLanes)), - didReceiveUpdate || JSCompiler_object_inline_digest_2474) + didReceiveUpdate || JSCompiler_object_inline_digest_2484) ) { - JSCompiler_object_inline_digest_2474 = workInProgressRoot; - if (null !== JSCompiler_object_inline_digest_2474) { - JSCompiler_object_inline_stack_2475 = renderLanes & -renderLanes; - if (0 !== (JSCompiler_object_inline_stack_2475 & SyncUpdateLanes)) - JSCompiler_object_inline_stack_2475 = SyncHydrationLane; + JSCompiler_object_inline_digest_2484 = workInProgressRoot; + if (null !== JSCompiler_object_inline_digest_2484) { + JSCompiler_object_inline_stack_2485 = renderLanes & -renderLanes; + if (0 !== (JSCompiler_object_inline_stack_2485 & SyncUpdateLanes)) + JSCompiler_object_inline_stack_2485 = SyncHydrationLane; else - switch (JSCompiler_object_inline_stack_2475) { + switch (JSCompiler_object_inline_stack_2485) { case SyncLane: - JSCompiler_object_inline_stack_2475 = SyncHydrationLane; + JSCompiler_object_inline_stack_2485 = SyncHydrationLane; break; case InputContinuousLane: - JSCompiler_object_inline_stack_2475 = + JSCompiler_object_inline_stack_2485 = InputContinuousHydrationLane; break; case DefaultLane: - JSCompiler_object_inline_stack_2475 = DefaultHydrationLane; + JSCompiler_object_inline_stack_2485 = DefaultHydrationLane; break; case 128: case 256: @@ -9544,40 +9570,40 @@ __DEV__ && case 8388608: case 16777216: case 33554432: - JSCompiler_object_inline_stack_2475 = TransitionHydrationLane; + JSCompiler_object_inline_stack_2485 = TransitionHydrationLane; break; case IdleLane: - JSCompiler_object_inline_stack_2475 = IdleHydrationLane; + JSCompiler_object_inline_stack_2485 = IdleHydrationLane; break; default: - JSCompiler_object_inline_stack_2475 = 0; + JSCompiler_object_inline_stack_2485 = 0; } - JSCompiler_object_inline_stack_2475 = + JSCompiler_object_inline_stack_2485 = 0 !== - (JSCompiler_object_inline_stack_2475 & - (JSCompiler_object_inline_digest_2474.suspendedLanes | + (JSCompiler_object_inline_stack_2485 & + (JSCompiler_object_inline_digest_2484.suspendedLanes | renderLanes)) ? 0 - : JSCompiler_object_inline_stack_2475; + : JSCompiler_object_inline_stack_2485; if ( - 0 !== JSCompiler_object_inline_stack_2475 && - JSCompiler_object_inline_stack_2475 !== prevState.retryLane + 0 !== JSCompiler_object_inline_stack_2485 && + JSCompiler_object_inline_stack_2485 !== prevState.retryLane ) throw ( - ((prevState.retryLane = JSCompiler_object_inline_stack_2475), + ((prevState.retryLane = JSCompiler_object_inline_stack_2485), enqueueConcurrentRenderForLane( current, - JSCompiler_object_inline_stack_2475 + JSCompiler_object_inline_stack_2485 ), scheduleUpdateOnFiber( - JSCompiler_object_inline_digest_2474, + JSCompiler_object_inline_digest_2484, current, - JSCompiler_object_inline_stack_2475 + JSCompiler_object_inline_stack_2485 ), SelectiveHydrationException) ); } - JSCompiler_object_inline_message_2473.data === + JSCompiler_object_inline_message_2483.data === SUSPENSE_PENDING_START_DATA || renderDidSuspendDelayIfPossible(); workInProgress = retrySuspenseComponentWithoutHydrating( current, @@ -9585,7 +9611,7 @@ __DEV__ && renderLanes ); } else - JSCompiler_object_inline_message_2473.data === + JSCompiler_object_inline_message_2483.data === SUSPENSE_PENDING_START_DATA ? ((workInProgress.flags |= 128), (workInProgress.child = current.child), @@ -9593,12 +9619,12 @@ __DEV__ && null, current )), - (JSCompiler_object_inline_message_2473._reactRetry = + (JSCompiler_object_inline_message_2483._reactRetry = workInProgress), (workInProgress = null)) : ((renderLanes = prevState.treeContext), (nextHydratableInstance = getNextHydratable( - JSCompiler_object_inline_message_2473.nextSibling + JSCompiler_object_inline_message_2483.nextSibling )), (hydrationParentFiber = workInProgress), (isHydrating = !0), @@ -9616,73 +9642,73 @@ __DEV__ && (treeContextProvider = workInProgress)), (workInProgress = mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_stack_2475.children + JSCompiler_object_inline_stack_2485.children )), (workInProgress.flags |= 4096)); return workInProgress; } - if (JSCompiler_object_inline_componentStack_2476) + if (JSCompiler_object_inline_componentStack_2486) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_componentStack_2476 = - JSCompiler_object_inline_stack_2475.fallback), - (JSCompiler_object_inline_message_2473 = workInProgress.mode), + (JSCompiler_object_inline_componentStack_2486 = + JSCompiler_object_inline_stack_2485.fallback), + (JSCompiler_object_inline_message_2483 = workInProgress.mode), (JSCompiler_temp = current.child), (instance = JSCompiler_temp.sibling), (componentStack = { mode: "hidden", - children: JSCompiler_object_inline_stack_2475.children + children: JSCompiler_object_inline_stack_2485.children }), disableLegacyMode || - (JSCompiler_object_inline_message_2473 & ConcurrentMode) !== NoMode || + (JSCompiler_object_inline_message_2483 & ConcurrentMode) !== NoMode || workInProgress.child === JSCompiler_temp - ? ((JSCompiler_object_inline_stack_2475 = createWorkInProgress( + ? ((JSCompiler_object_inline_stack_2485 = createWorkInProgress( JSCompiler_temp, componentStack )), - (JSCompiler_object_inline_stack_2475.subtreeFlags = + (JSCompiler_object_inline_stack_2485.subtreeFlags = JSCompiler_temp.subtreeFlags & 31457280)) - : ((JSCompiler_object_inline_stack_2475 = workInProgress.child), - (JSCompiler_object_inline_stack_2475.childLanes = 0), - (JSCompiler_object_inline_stack_2475.pendingProps = + : ((JSCompiler_object_inline_stack_2485 = workInProgress.child), + (JSCompiler_object_inline_stack_2485.childLanes = 0), + (JSCompiler_object_inline_stack_2485.pendingProps = componentStack), workInProgress.mode & ProfileMode && - ((JSCompiler_object_inline_stack_2475.actualDuration = 0), - (JSCompiler_object_inline_stack_2475.actualStartTime = -1), - (JSCompiler_object_inline_stack_2475.selfBaseDuration = + ((JSCompiler_object_inline_stack_2485.actualDuration = 0), + (JSCompiler_object_inline_stack_2485.actualStartTime = -1), + (JSCompiler_object_inline_stack_2485.selfBaseDuration = JSCompiler_temp.selfBaseDuration), - (JSCompiler_object_inline_stack_2475.treeBaseDuration = + (JSCompiler_object_inline_stack_2485.treeBaseDuration = JSCompiler_temp.treeBaseDuration)), (workInProgress.deletions = null)), null !== instance - ? (JSCompiler_object_inline_componentStack_2476 = + ? (JSCompiler_object_inline_componentStack_2486 = createWorkInProgress( instance, - JSCompiler_object_inline_componentStack_2476 + JSCompiler_object_inline_componentStack_2486 )) - : ((JSCompiler_object_inline_componentStack_2476 = + : ((JSCompiler_object_inline_componentStack_2486 = createFiberFromFragment( - JSCompiler_object_inline_componentStack_2476, - JSCompiler_object_inline_message_2473, + JSCompiler_object_inline_componentStack_2486, + JSCompiler_object_inline_message_2483, renderLanes, null )), - (JSCompiler_object_inline_componentStack_2476.flags |= 2)), - (JSCompiler_object_inline_componentStack_2476.return = + (JSCompiler_object_inline_componentStack_2486.flags |= 2)), + (JSCompiler_object_inline_componentStack_2486.return = workInProgress), - (JSCompiler_object_inline_stack_2475.return = workInProgress), - (JSCompiler_object_inline_stack_2475.sibling = - JSCompiler_object_inline_componentStack_2476), - (workInProgress.child = JSCompiler_object_inline_stack_2475), - (JSCompiler_object_inline_stack_2475 = - JSCompiler_object_inline_componentStack_2476), - (JSCompiler_object_inline_componentStack_2476 = workInProgress.child), - (JSCompiler_object_inline_message_2473 = current.child.memoizedState), - null === JSCompiler_object_inline_message_2473 - ? (JSCompiler_object_inline_message_2473 = + (JSCompiler_object_inline_stack_2485.return = workInProgress), + (JSCompiler_object_inline_stack_2485.sibling = + JSCompiler_object_inline_componentStack_2486), + (workInProgress.child = JSCompiler_object_inline_stack_2485), + (JSCompiler_object_inline_stack_2485 = + JSCompiler_object_inline_componentStack_2486), + (JSCompiler_object_inline_componentStack_2486 = workInProgress.child), + (JSCompiler_object_inline_message_2483 = current.child.memoizedState), + null === JSCompiler_object_inline_message_2483 + ? (JSCompiler_object_inline_message_2483 = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = - JSCompiler_object_inline_message_2473.cachePool), + JSCompiler_object_inline_message_2483.cachePool), null !== JSCompiler_temp ? ((instance = CacheContext._currentValue), (JSCompiler_temp = @@ -9690,34 +9716,34 @@ __DEV__ && ? { parent: instance, pool: instance } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), - (JSCompiler_object_inline_message_2473 = { + (JSCompiler_object_inline_message_2483 = { baseLanes: - JSCompiler_object_inline_message_2473.baseLanes | renderLanes, + JSCompiler_object_inline_message_2483.baseLanes | renderLanes, cachePool: JSCompiler_temp })), - (JSCompiler_object_inline_componentStack_2476.memoizedState = - JSCompiler_object_inline_message_2473), + (JSCompiler_object_inline_componentStack_2486.memoizedState = + JSCompiler_object_inline_message_2483), enableTransitionTracing && - ((JSCompiler_object_inline_message_2473 = enableTransitionTracing + ((JSCompiler_object_inline_message_2483 = enableTransitionTracing ? transitionStack.current : null), - null !== JSCompiler_object_inline_message_2473 && + null !== JSCompiler_object_inline_message_2483 && ((JSCompiler_temp = enableTransitionTracing ? markerInstanceStack.current : null), (instance = - JSCompiler_object_inline_componentStack_2476.updateQueue), + JSCompiler_object_inline_componentStack_2486.updateQueue), (componentStack = current.updateQueue), null === instance - ? (JSCompiler_object_inline_componentStack_2476.updateQueue = { - transitions: JSCompiler_object_inline_message_2473, + ? (JSCompiler_object_inline_componentStack_2486.updateQueue = { + transitions: JSCompiler_object_inline_message_2483, markerInstances: JSCompiler_temp, retryQueue: null }) : instance === componentStack - ? (JSCompiler_object_inline_componentStack_2476.updateQueue = + ? (JSCompiler_object_inline_componentStack_2486.updateQueue = { - transitions: JSCompiler_object_inline_message_2473, + transitions: JSCompiler_object_inline_message_2483, markerInstances: JSCompiler_temp, retryQueue: null !== componentStack @@ -9725,41 +9751,41 @@ __DEV__ && : null }) : ((instance.transitions = - JSCompiler_object_inline_message_2473), + JSCompiler_object_inline_message_2483), (instance.markerInstances = JSCompiler_temp)))), - (JSCompiler_object_inline_componentStack_2476.childLanes = + (JSCompiler_object_inline_componentStack_2486.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2474, + JSCompiler_object_inline_digest_2484, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2475 + JSCompiler_object_inline_stack_2485 ); pushPrimaryTreeSuspenseHandler(workInProgress); - JSCompiler_object_inline_digest_2474 = current.child; - current = JSCompiler_object_inline_digest_2474.sibling; - JSCompiler_object_inline_digest_2474 = createWorkInProgress( - JSCompiler_object_inline_digest_2474, + JSCompiler_object_inline_digest_2484 = current.child; + current = JSCompiler_object_inline_digest_2484.sibling; + JSCompiler_object_inline_digest_2484 = createWorkInProgress( + JSCompiler_object_inline_digest_2484, { mode: "visible", - children: JSCompiler_object_inline_stack_2475.children + children: JSCompiler_object_inline_stack_2485.children } ); disableLegacyMode || (workInProgress.mode & ConcurrentMode) !== NoMode || - (JSCompiler_object_inline_digest_2474.lanes = renderLanes); - JSCompiler_object_inline_digest_2474.return = workInProgress; - JSCompiler_object_inline_digest_2474.sibling = null; + (JSCompiler_object_inline_digest_2484.lanes = renderLanes); + JSCompiler_object_inline_digest_2484.return = workInProgress; + JSCompiler_object_inline_digest_2484.sibling = null; null !== current && ((renderLanes = workInProgress.deletions), null === renderLanes ? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16)) : renderLanes.push(current)); - workInProgress.child = JSCompiler_object_inline_digest_2474; + workInProgress.child = JSCompiler_object_inline_digest_2484; workInProgress.memoizedState = null; - return JSCompiler_object_inline_digest_2474; + return JSCompiler_object_inline_digest_2484; } function mountSuspensePrimaryChildren(workInProgress, primaryChildren) { primaryChildren = createFiberFromOffscreen( @@ -11189,8 +11215,19 @@ __DEV__ && a: for (; null !== list; ) { var dependency = list; list = fiber; - for (var i = 0; i < contexts.length; i++) + var i = 0; + b: for (; i < contexts.length; i++) if (dependency.context === contexts[i]) { + var select = dependency.select; + if ( + null != select && + null != dependency.lastSelectedValue && + !checkIfSelectedContextValuesChanged( + dependency.lastSelectedValue, + select(dependency.context._currentValue) + ) + ) + continue b; list.lanes |= renderLanes; dependency = list.alternate; null !== dependency && (dependency.lanes |= renderLanes); @@ -11295,6 +11332,17 @@ __DEV__ && workInProgress.flags |= 262144; } } + function checkIfSelectedContextValuesChanged( + oldComparedValue, + newComparedValue + ) { + if (isArrayImpl(oldComparedValue) && isArrayImpl(newComparedValue)) { + if (oldComparedValue.length !== newComparedValue.length) return !0; + for (var i = 0; i < oldComparedValue.length; i++) + if (!objectIs(newComparedValue[i], oldComparedValue[i])) return !0; + } else throw Error("Compared context values must be arrays"); + return !1; + } function checkIfContextChanged(currentDependencies) { if (!enableLazyContextPropagation) return !1; for ( @@ -11302,13 +11350,20 @@ __DEV__ && null !== currentDependencies; ) { + var newValue = currentDependencies.context._currentValue, + oldValue = currentDependencies.memoizedValue; if ( - !objectIs( - currentDependencies.context._currentValue, - currentDependencies.memoizedValue + null != currentDependencies.select && + null != currentDependencies.lastSelectedValue + ) { + if ( + checkIfSelectedContextValuesChanged( + currentDependencies.lastSelectedValue, + currentDependencies.select(newValue) + ) ) - ) - return !0; + return !0; + } else if (!objectIs(newValue, oldValue)) return !0; currentDependencies = currentDependencies.next; } return !1; @@ -25839,6 +25894,8 @@ __DEV__ && ContextOnlyDispatcher.useFormState = throwInvalidHookError; ContextOnlyDispatcher.useActionState = throwInvalidHookError; ContextOnlyDispatcher.useOptimistic = throwInvalidHookError; + ContextOnlyDispatcher.unstable_useContextWithBailout = + throwInvalidHookError; var HooksDispatcherOnMountInDEV = null, HooksDispatcherOnMountWithHookTypesInDEV = null, HooksDispatcherOnUpdateInDEV = null, @@ -25990,6 +26047,14 @@ __DEV__ && mountHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnMountInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + mountHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnMountWithHookTypesInDEV = { readContext: function (context) { return readContext(context); @@ -26135,6 +26200,12 @@ __DEV__ && updateHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnMountWithHookTypesInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnUpdateInDEV = { readContext: function (context) { return readContext(context); @@ -26273,6 +26344,14 @@ __DEV__ && updateHookTypesDev(); return updateOptimistic(passthrough, reducer); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnRerenderInDEV = { readContext: function (context) { return readContext(context); @@ -26411,6 +26490,14 @@ __DEV__ && updateHookTypesDev(); return rerenderOptimistic(passthrough, reducer); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnMountInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -26579,6 +26666,15 @@ __DEV__ && mountHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnUpdateInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -26744,6 +26840,13 @@ __DEV__ && updateHookTypesDev(); return updateOptimistic(passthrough, reducer); }; + InvalidNestedHooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnRerenderInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -26911,6 +27014,13 @@ __DEV__ && updateHookTypesDev(); return rerenderOptimistic(passthrough, reducer); }; + InvalidNestedHooksDispatcherOnRerenderInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; var now = Scheduler.unstable_now, commitTime = 0, layoutEffectStartTime = -1, @@ -28029,11 +28139,11 @@ __DEV__ && : flushSyncErrorInBuildsThatSupportLegacyMode; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-www-classic-7f217d1d-20240725" !== isomorphicReactPackageVersion) + if ("19.0.0-www-classic-b9af819f-20240726" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-www-classic-7f217d1d-20240725\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-www-classic-b9af819f-20240726\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -28099,12 +28209,12 @@ __DEV__ && scheduleRoot: scheduleRoot, setRefreshHandler: setRefreshHandler, getCurrentFiber: getCurrentFiberForDevTools, - reconcilerVersion: "19.0.0-www-classic-7f217d1d-20240725" + reconcilerVersion: "19.0.0-www-classic-b9af819f-20240726" }); })({ findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 1, - version: "19.0.0-www-classic-7f217d1d-20240725", + version: "19.0.0-www-classic-b9af819f-20240726", rendererPackageName: "react-dom" }) && canUseDOM && @@ -28906,5 +29016,5 @@ __DEV__ && exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.0.0-www-classic-7f217d1d-20240725"; + exports.version = "19.0.0-www-classic-b9af819f-20240726"; })(); diff --git a/compiled/facebook-www/ReactDOMTesting-dev.modern.js b/compiled/facebook-www/ReactDOMTesting-dev.modern.js index 7dc0e6bb0c4c7..508ba1bde9beb 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.modern.js @@ -5872,6 +5872,32 @@ __DEV__ && } return workInProgressHook; } + function unstable_useContextWithBailout(context, select) { + if (null === select) return readContext(context); + if (!enableLazyContextPropagation) throw Error("Not implemented."); + var consumer = currentlyRenderingFiber, + value = context._currentValue; + if (lastFullyObservedContext !== context) + if ( + ((context = { + context: context, + memoizedValue: value, + next: null, + select: select, + lastSelectedValue: select(value) + }), + null === lastContextDependency) + ) { + if (null === consumer) + throw Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + enableLazyContextPropagation && (consumer.flags |= 524288); + } else lastContextDependency = lastContextDependency.next = context; + return value; + } function useThenable(thenable) { var index = thenableIndexCounter; thenableIndexCounter += 1; @@ -8896,32 +8922,32 @@ __DEV__ && return current; } function updateSuspenseComponent(current, workInProgress, renderLanes) { - var JSCompiler_object_inline_digest_2486; - var JSCompiler_object_inline_stack_2487 = workInProgress.pendingProps; + var JSCompiler_object_inline_digest_2496; + var JSCompiler_object_inline_stack_2497 = workInProgress.pendingProps; shouldSuspendImpl(workInProgress) && (workInProgress.flags |= 128); - var JSCompiler_object_inline_componentStack_2488 = !1; + var JSCompiler_object_inline_componentStack_2498 = !1; var didSuspend = 0 !== (workInProgress.flags & 128); - (JSCompiler_object_inline_digest_2486 = didSuspend) || - (JSCompiler_object_inline_digest_2486 = + (JSCompiler_object_inline_digest_2496 = didSuspend) || + (JSCompiler_object_inline_digest_2496 = null !== current && null === current.memoizedState ? !1 : 0 !== (suspenseStackCursor.current & ForceSuspenseFallback)); - JSCompiler_object_inline_digest_2486 && - ((JSCompiler_object_inline_componentStack_2488 = !0), + JSCompiler_object_inline_digest_2496 && + ((JSCompiler_object_inline_componentStack_2498 = !0), (workInProgress.flags &= -129)); - JSCompiler_object_inline_digest_2486 = 0 !== (workInProgress.flags & 32); + JSCompiler_object_inline_digest_2496 = 0 !== (workInProgress.flags & 32); workInProgress.flags &= -33; if (null === current) { if (isHydrating) { - JSCompiler_object_inline_componentStack_2488 + JSCompiler_object_inline_componentStack_2498 ? pushPrimaryTreeSuspenseHandler(workInProgress) : reuseSuspenseHandlerOnStack(workInProgress); if (isHydrating) { - var JSCompiler_object_inline_message_2485 = nextHydratableInstance; + var JSCompiler_object_inline_message_2495 = nextHydratableInstance; var JSCompiler_temp; - if (!(JSCompiler_temp = !JSCompiler_object_inline_message_2485)) { + if (!(JSCompiler_temp = !JSCompiler_object_inline_message_2495)) { c: { - var instance = JSCompiler_object_inline_message_2485; + var instance = JSCompiler_object_inline_message_2495; for ( JSCompiler_temp = rootOrSingletonContext; instance.nodeType !== COMMENT_NODE; @@ -8962,19 +8988,19 @@ __DEV__ && JSCompiler_temp && (warnNonHydratedInstance( workInProgress, - JSCompiler_object_inline_message_2485 + JSCompiler_object_inline_message_2495 ), throwOnHydrationMismatch(workInProgress)); } - JSCompiler_object_inline_message_2485 = workInProgress.memoizedState; + JSCompiler_object_inline_message_2495 = workInProgress.memoizedState; if ( - null !== JSCompiler_object_inline_message_2485 && - ((JSCompiler_object_inline_message_2485 = - JSCompiler_object_inline_message_2485.dehydrated), - null !== JSCompiler_object_inline_message_2485) + null !== JSCompiler_object_inline_message_2495 && + ((JSCompiler_object_inline_message_2495 = + JSCompiler_object_inline_message_2495.dehydrated), + null !== JSCompiler_object_inline_message_2495) ) return ( - JSCompiler_object_inline_message_2485.data === + JSCompiler_object_inline_message_2495.data === SUSPENSE_FALLBACK_START_DATA ? (workInProgress.lanes = DefaultHydrationLane) : (workInProgress.lanes = OffscreenLane), @@ -8982,27 +9008,27 @@ __DEV__ && ); popSuspenseHandler(workInProgress); } - JSCompiler_object_inline_message_2485 = - JSCompiler_object_inline_stack_2487.children; - JSCompiler_temp = JSCompiler_object_inline_stack_2487.fallback; - if (JSCompiler_object_inline_componentStack_2488) + JSCompiler_object_inline_message_2495 = + JSCompiler_object_inline_stack_2497.children; + JSCompiler_temp = JSCompiler_object_inline_stack_2497.fallback; + if (JSCompiler_object_inline_componentStack_2498) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_stack_2487 = + (JSCompiler_object_inline_stack_2497 = mountSuspenseFallbackChildren( workInProgress, - JSCompiler_object_inline_message_2485, + JSCompiler_object_inline_message_2495, JSCompiler_temp, renderLanes )), - (JSCompiler_object_inline_componentStack_2488 = + (JSCompiler_object_inline_componentStack_2498 = workInProgress.child), - (JSCompiler_object_inline_componentStack_2488.memoizedState = + (JSCompiler_object_inline_componentStack_2498.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_componentStack_2488.childLanes = + (JSCompiler_object_inline_componentStack_2498.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2486, + JSCompiler_object_inline_digest_2496, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), @@ -9015,9 +9041,9 @@ __DEV__ && ? markerInstanceStack.current : null), (renderLanes = - JSCompiler_object_inline_componentStack_2488.updateQueue), + JSCompiler_object_inline_componentStack_2498.updateQueue), null === renderLanes - ? (JSCompiler_object_inline_componentStack_2488.updateQueue = + ? (JSCompiler_object_inline_componentStack_2498.updateQueue = { transitions: workInProgress, markerInstances: current, @@ -9025,46 +9051,46 @@ __DEV__ && }) : ((renderLanes.transitions = workInProgress), (renderLanes.markerInstances = current)))), - JSCompiler_object_inline_stack_2487 + JSCompiler_object_inline_stack_2497 ); if ( "number" === - typeof JSCompiler_object_inline_stack_2487.unstable_expectedLoadTime + typeof JSCompiler_object_inline_stack_2497.unstable_expectedLoadTime ) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_stack_2487 = + (JSCompiler_object_inline_stack_2497 = mountSuspenseFallbackChildren( workInProgress, - JSCompiler_object_inline_message_2485, + JSCompiler_object_inline_message_2495, JSCompiler_temp, renderLanes )), - (JSCompiler_object_inline_componentStack_2488 = + (JSCompiler_object_inline_componentStack_2498 = workInProgress.child), - (JSCompiler_object_inline_componentStack_2488.memoizedState = + (JSCompiler_object_inline_componentStack_2498.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_componentStack_2488.childLanes = + (JSCompiler_object_inline_componentStack_2498.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2486, + JSCompiler_object_inline_digest_2496, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress.lanes = 4194304), - JSCompiler_object_inline_stack_2487 + JSCompiler_object_inline_stack_2497 ); pushPrimaryTreeSuspenseHandler(workInProgress); return mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_message_2485 + JSCompiler_object_inline_message_2495 ); } var prevState = current.memoizedState; if ( null !== prevState && - ((JSCompiler_object_inline_message_2485 = prevState.dehydrated), - null !== JSCompiler_object_inline_message_2485) + ((JSCompiler_object_inline_message_2495 = prevState.dehydrated), + null !== JSCompiler_object_inline_message_2495) ) { if (didSuspend) workInProgress.flags & 256 @@ -9081,94 +9107,94 @@ __DEV__ && (workInProgress.flags |= 128), (workInProgress = null)) : (reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_componentStack_2488 = - JSCompiler_object_inline_stack_2487.fallback), - (JSCompiler_object_inline_message_2485 = workInProgress.mode), - (JSCompiler_object_inline_stack_2487 = + (JSCompiler_object_inline_componentStack_2498 = + JSCompiler_object_inline_stack_2497.fallback), + (JSCompiler_object_inline_message_2495 = workInProgress.mode), + (JSCompiler_object_inline_stack_2497 = mountWorkInProgressOffscreenFiber( { mode: "visible", - children: JSCompiler_object_inline_stack_2487.children + children: JSCompiler_object_inline_stack_2497.children }, - JSCompiler_object_inline_message_2485 + JSCompiler_object_inline_message_2495 )), - (JSCompiler_object_inline_componentStack_2488 = + (JSCompiler_object_inline_componentStack_2498 = createFiberFromFragment( - JSCompiler_object_inline_componentStack_2488, - JSCompiler_object_inline_message_2485, + JSCompiler_object_inline_componentStack_2498, + JSCompiler_object_inline_message_2495, renderLanes, null )), - (JSCompiler_object_inline_componentStack_2488.flags |= 2), - (JSCompiler_object_inline_stack_2487.return = workInProgress), - (JSCompiler_object_inline_componentStack_2488.return = + (JSCompiler_object_inline_componentStack_2498.flags |= 2), + (JSCompiler_object_inline_stack_2497.return = workInProgress), + (JSCompiler_object_inline_componentStack_2498.return = workInProgress), - (JSCompiler_object_inline_stack_2487.sibling = - JSCompiler_object_inline_componentStack_2488), - (workInProgress.child = JSCompiler_object_inline_stack_2487), + (JSCompiler_object_inline_stack_2497.sibling = + JSCompiler_object_inline_componentStack_2498), + (workInProgress.child = JSCompiler_object_inline_stack_2497), reconcileChildFibers( workInProgress, current.child, null, renderLanes ), - (JSCompiler_object_inline_stack_2487 = workInProgress.child), - (JSCompiler_object_inline_stack_2487.memoizedState = + (JSCompiler_object_inline_stack_2497 = workInProgress.child), + (JSCompiler_object_inline_stack_2497.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_stack_2487.childLanes = + (JSCompiler_object_inline_stack_2497.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2486, + JSCompiler_object_inline_digest_2496, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress = - JSCompiler_object_inline_componentStack_2488)); + JSCompiler_object_inline_componentStack_2498)); else if ( (pushPrimaryTreeSuspenseHandler(workInProgress), isHydrating && error$jscomp$0( "We should not be hydrating here. This is a bug in React. Please file a bug." ), - JSCompiler_object_inline_message_2485.data === + JSCompiler_object_inline_message_2495.data === SUSPENSE_FALLBACK_START_DATA) ) { - JSCompiler_object_inline_digest_2486 = - JSCompiler_object_inline_message_2485.nextSibling && - JSCompiler_object_inline_message_2485.nextSibling.dataset; - if (JSCompiler_object_inline_digest_2486) { - JSCompiler_temp = JSCompiler_object_inline_digest_2486.dgst; - var message = JSCompiler_object_inline_digest_2486.msg; - instance = JSCompiler_object_inline_digest_2486.stck; - var componentStack = JSCompiler_object_inline_digest_2486.cstck; + JSCompiler_object_inline_digest_2496 = + JSCompiler_object_inline_message_2495.nextSibling && + JSCompiler_object_inline_message_2495.nextSibling.dataset; + if (JSCompiler_object_inline_digest_2496) { + JSCompiler_temp = JSCompiler_object_inline_digest_2496.dgst; + var message = JSCompiler_object_inline_digest_2496.msg; + instance = JSCompiler_object_inline_digest_2496.stck; + var componentStack = JSCompiler_object_inline_digest_2496.cstck; } - JSCompiler_object_inline_message_2485 = message; - JSCompiler_object_inline_digest_2486 = JSCompiler_temp; - JSCompiler_object_inline_stack_2487 = instance; - JSCompiler_object_inline_componentStack_2488 = componentStack; - JSCompiler_object_inline_message_2485 = - JSCompiler_object_inline_message_2485 - ? Error(JSCompiler_object_inline_message_2485) + JSCompiler_object_inline_message_2495 = message; + JSCompiler_object_inline_digest_2496 = JSCompiler_temp; + JSCompiler_object_inline_stack_2497 = instance; + JSCompiler_object_inline_componentStack_2498 = componentStack; + JSCompiler_object_inline_message_2495 = + JSCompiler_object_inline_message_2495 + ? Error(JSCompiler_object_inline_message_2495) : Error( "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." ); - JSCompiler_object_inline_message_2485.stack = - JSCompiler_object_inline_stack_2487 || ""; - JSCompiler_object_inline_message_2485.digest = - JSCompiler_object_inline_digest_2486; - JSCompiler_object_inline_digest_2486 = - void 0 === JSCompiler_object_inline_componentStack_2488 + JSCompiler_object_inline_message_2495.stack = + JSCompiler_object_inline_stack_2497 || ""; + JSCompiler_object_inline_message_2495.digest = + JSCompiler_object_inline_digest_2496; + JSCompiler_object_inline_digest_2496 = + void 0 === JSCompiler_object_inline_componentStack_2498 ? null - : JSCompiler_object_inline_componentStack_2488; - "string" === typeof JSCompiler_object_inline_digest_2486 && + : JSCompiler_object_inline_componentStack_2498; + "string" === typeof JSCompiler_object_inline_digest_2496 && CapturedStacks.set( - JSCompiler_object_inline_message_2485, - JSCompiler_object_inline_digest_2486 + JSCompiler_object_inline_message_2495, + JSCompiler_object_inline_digest_2496 ); queueHydrationError({ - value: JSCompiler_object_inline_message_2485, + value: JSCompiler_object_inline_message_2495, source: null, - stack: JSCompiler_object_inline_digest_2486 + stack: JSCompiler_object_inline_digest_2496 }); workInProgress = retrySuspenseComponentWithoutHydrating( current, @@ -9184,26 +9210,26 @@ __DEV__ && renderLanes, !1 ), - (JSCompiler_object_inline_digest_2486 = + (JSCompiler_object_inline_digest_2496 = 0 !== (renderLanes & current.childLanes)), - didReceiveUpdate || JSCompiler_object_inline_digest_2486) + didReceiveUpdate || JSCompiler_object_inline_digest_2496) ) { - JSCompiler_object_inline_digest_2486 = workInProgressRoot; - if (null !== JSCompiler_object_inline_digest_2486) { - JSCompiler_object_inline_stack_2487 = renderLanes & -renderLanes; - if (0 !== (JSCompiler_object_inline_stack_2487 & SyncUpdateLanes)) - JSCompiler_object_inline_stack_2487 = SyncHydrationLane; + JSCompiler_object_inline_digest_2496 = workInProgressRoot; + if (null !== JSCompiler_object_inline_digest_2496) { + JSCompiler_object_inline_stack_2497 = renderLanes & -renderLanes; + if (0 !== (JSCompiler_object_inline_stack_2497 & SyncUpdateLanes)) + JSCompiler_object_inline_stack_2497 = SyncHydrationLane; else - switch (JSCompiler_object_inline_stack_2487) { + switch (JSCompiler_object_inline_stack_2497) { case SyncLane: - JSCompiler_object_inline_stack_2487 = SyncHydrationLane; + JSCompiler_object_inline_stack_2497 = SyncHydrationLane; break; case InputContinuousLane: - JSCompiler_object_inline_stack_2487 = + JSCompiler_object_inline_stack_2497 = InputContinuousHydrationLane; break; case DefaultLane: - JSCompiler_object_inline_stack_2487 = DefaultHydrationLane; + JSCompiler_object_inline_stack_2497 = DefaultHydrationLane; break; case 128: case 256: @@ -9224,40 +9250,40 @@ __DEV__ && case 8388608: case 16777216: case 33554432: - JSCompiler_object_inline_stack_2487 = TransitionHydrationLane; + JSCompiler_object_inline_stack_2497 = TransitionHydrationLane; break; case IdleLane: - JSCompiler_object_inline_stack_2487 = IdleHydrationLane; + JSCompiler_object_inline_stack_2497 = IdleHydrationLane; break; default: - JSCompiler_object_inline_stack_2487 = 0; + JSCompiler_object_inline_stack_2497 = 0; } - JSCompiler_object_inline_stack_2487 = + JSCompiler_object_inline_stack_2497 = 0 !== - (JSCompiler_object_inline_stack_2487 & - (JSCompiler_object_inline_digest_2486.suspendedLanes | + (JSCompiler_object_inline_stack_2497 & + (JSCompiler_object_inline_digest_2496.suspendedLanes | renderLanes)) ? 0 - : JSCompiler_object_inline_stack_2487; + : JSCompiler_object_inline_stack_2497; if ( - 0 !== JSCompiler_object_inline_stack_2487 && - JSCompiler_object_inline_stack_2487 !== prevState.retryLane + 0 !== JSCompiler_object_inline_stack_2497 && + JSCompiler_object_inline_stack_2497 !== prevState.retryLane ) throw ( - ((prevState.retryLane = JSCompiler_object_inline_stack_2487), + ((prevState.retryLane = JSCompiler_object_inline_stack_2497), enqueueConcurrentRenderForLane( current, - JSCompiler_object_inline_stack_2487 + JSCompiler_object_inline_stack_2497 ), scheduleUpdateOnFiber( - JSCompiler_object_inline_digest_2486, + JSCompiler_object_inline_digest_2496, current, - JSCompiler_object_inline_stack_2487 + JSCompiler_object_inline_stack_2497 ), SelectiveHydrationException) ); } - JSCompiler_object_inline_message_2485.data === + JSCompiler_object_inline_message_2495.data === SUSPENSE_PENDING_START_DATA || renderDidSuspendDelayIfPossible(); workInProgress = retrySuspenseComponentWithoutHydrating( current, @@ -9265,7 +9291,7 @@ __DEV__ && renderLanes ); } else - JSCompiler_object_inline_message_2485.data === + JSCompiler_object_inline_message_2495.data === SUSPENSE_PENDING_START_DATA ? ((workInProgress.flags |= 128), (workInProgress.child = current.child), @@ -9273,12 +9299,12 @@ __DEV__ && null, current )), - (JSCompiler_object_inline_message_2485._reactRetry = + (JSCompiler_object_inline_message_2495._reactRetry = workInProgress), (workInProgress = null)) : ((current = prevState.treeContext), (nextHydratableInstance = getNextHydratable( - JSCompiler_object_inline_message_2485.nextSibling + JSCompiler_object_inline_message_2495.nextSibling )), (hydrationParentFiber = workInProgress), (isHydrating = !0), @@ -9296,57 +9322,57 @@ __DEV__ && (treeContextProvider = workInProgress)), (workInProgress = mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_stack_2487.children + JSCompiler_object_inline_stack_2497.children )), (workInProgress.flags |= 4096)); return workInProgress; } - if (JSCompiler_object_inline_componentStack_2488) + if (JSCompiler_object_inline_componentStack_2498) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_componentStack_2488 = - JSCompiler_object_inline_stack_2487.fallback), - (JSCompiler_object_inline_message_2485 = workInProgress.mode), + (JSCompiler_object_inline_componentStack_2498 = + JSCompiler_object_inline_stack_2497.fallback), + (JSCompiler_object_inline_message_2495 = workInProgress.mode), (JSCompiler_temp = current.child), (instance = JSCompiler_temp.sibling), - (JSCompiler_object_inline_stack_2487 = createWorkInProgress( + (JSCompiler_object_inline_stack_2497 = createWorkInProgress( JSCompiler_temp, { mode: "hidden", - children: JSCompiler_object_inline_stack_2487.children + children: JSCompiler_object_inline_stack_2497.children } )), - (JSCompiler_object_inline_stack_2487.subtreeFlags = + (JSCompiler_object_inline_stack_2497.subtreeFlags = JSCompiler_temp.subtreeFlags & 31457280), null !== instance - ? (JSCompiler_object_inline_componentStack_2488 = + ? (JSCompiler_object_inline_componentStack_2498 = createWorkInProgress( instance, - JSCompiler_object_inline_componentStack_2488 + JSCompiler_object_inline_componentStack_2498 )) - : ((JSCompiler_object_inline_componentStack_2488 = + : ((JSCompiler_object_inline_componentStack_2498 = createFiberFromFragment( - JSCompiler_object_inline_componentStack_2488, - JSCompiler_object_inline_message_2485, + JSCompiler_object_inline_componentStack_2498, + JSCompiler_object_inline_message_2495, renderLanes, null )), - (JSCompiler_object_inline_componentStack_2488.flags |= 2)), - (JSCompiler_object_inline_componentStack_2488.return = + (JSCompiler_object_inline_componentStack_2498.flags |= 2)), + (JSCompiler_object_inline_componentStack_2498.return = workInProgress), - (JSCompiler_object_inline_stack_2487.return = workInProgress), - (JSCompiler_object_inline_stack_2487.sibling = - JSCompiler_object_inline_componentStack_2488), - (workInProgress.child = JSCompiler_object_inline_stack_2487), - (JSCompiler_object_inline_stack_2487 = - JSCompiler_object_inline_componentStack_2488), - (JSCompiler_object_inline_componentStack_2488 = workInProgress.child), - (JSCompiler_object_inline_message_2485 = current.child.memoizedState), - null === JSCompiler_object_inline_message_2485 - ? (JSCompiler_object_inline_message_2485 = + (JSCompiler_object_inline_stack_2497.return = workInProgress), + (JSCompiler_object_inline_stack_2497.sibling = + JSCompiler_object_inline_componentStack_2498), + (workInProgress.child = JSCompiler_object_inline_stack_2497), + (JSCompiler_object_inline_stack_2497 = + JSCompiler_object_inline_componentStack_2498), + (JSCompiler_object_inline_componentStack_2498 = workInProgress.child), + (JSCompiler_object_inline_message_2495 = current.child.memoizedState), + null === JSCompiler_object_inline_message_2495 + ? (JSCompiler_object_inline_message_2495 = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = - JSCompiler_object_inline_message_2485.cachePool), + JSCompiler_object_inline_message_2495.cachePool), null !== JSCompiler_temp ? ((instance = CacheContext._currentValue), (JSCompiler_temp = @@ -9354,34 +9380,34 @@ __DEV__ && ? { parent: instance, pool: instance } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), - (JSCompiler_object_inline_message_2485 = { + (JSCompiler_object_inline_message_2495 = { baseLanes: - JSCompiler_object_inline_message_2485.baseLanes | renderLanes, + JSCompiler_object_inline_message_2495.baseLanes | renderLanes, cachePool: JSCompiler_temp })), - (JSCompiler_object_inline_componentStack_2488.memoizedState = - JSCompiler_object_inline_message_2485), + (JSCompiler_object_inline_componentStack_2498.memoizedState = + JSCompiler_object_inline_message_2495), enableTransitionTracing && - ((JSCompiler_object_inline_message_2485 = enableTransitionTracing + ((JSCompiler_object_inline_message_2495 = enableTransitionTracing ? transitionStack.current : null), - null !== JSCompiler_object_inline_message_2485 && + null !== JSCompiler_object_inline_message_2495 && ((JSCompiler_temp = enableTransitionTracing ? markerInstanceStack.current : null), (instance = - JSCompiler_object_inline_componentStack_2488.updateQueue), + JSCompiler_object_inline_componentStack_2498.updateQueue), (componentStack = current.updateQueue), null === instance - ? (JSCompiler_object_inline_componentStack_2488.updateQueue = { - transitions: JSCompiler_object_inline_message_2485, + ? (JSCompiler_object_inline_componentStack_2498.updateQueue = { + transitions: JSCompiler_object_inline_message_2495, markerInstances: JSCompiler_temp, retryQueue: null }) : instance === componentStack - ? (JSCompiler_object_inline_componentStack_2488.updateQueue = + ? (JSCompiler_object_inline_componentStack_2498.updateQueue = { - transitions: JSCompiler_object_inline_message_2485, + transitions: JSCompiler_object_inline_message_2495, markerInstances: JSCompiler_temp, retryQueue: null !== componentStack @@ -9389,32 +9415,32 @@ __DEV__ && : null }) : ((instance.transitions = - JSCompiler_object_inline_message_2485), + JSCompiler_object_inline_message_2495), (instance.markerInstances = JSCompiler_temp)))), - (JSCompiler_object_inline_componentStack_2488.childLanes = + (JSCompiler_object_inline_componentStack_2498.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2486, + JSCompiler_object_inline_digest_2496, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2487 + JSCompiler_object_inline_stack_2497 ); pushPrimaryTreeSuspenseHandler(workInProgress); renderLanes = current.child; current = renderLanes.sibling; renderLanes = createWorkInProgress(renderLanes, { mode: "visible", - children: JSCompiler_object_inline_stack_2487.children + children: JSCompiler_object_inline_stack_2497.children }); renderLanes.return = workInProgress; renderLanes.sibling = null; null !== current && - ((JSCompiler_object_inline_digest_2486 = workInProgress.deletions), - null === JSCompiler_object_inline_digest_2486 + ((JSCompiler_object_inline_digest_2496 = workInProgress.deletions), + null === JSCompiler_object_inline_digest_2496 ? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16)) - : JSCompiler_object_inline_digest_2486.push(current)); + : JSCompiler_object_inline_digest_2496.push(current)); workInProgress.child = renderLanes; workInProgress.memoizedState = null; return renderLanes; @@ -10797,8 +10823,19 @@ __DEV__ && a: for (; null !== list; ) { var dependency = list; list = fiber; - for (var i = 0; i < contexts.length; i++) + var i = 0; + b: for (; i < contexts.length; i++) if (dependency.context === contexts[i]) { + var select = dependency.select; + if ( + null != select && + null != dependency.lastSelectedValue && + !checkIfSelectedContextValuesChanged( + dependency.lastSelectedValue, + select(dependency.context._currentValue) + ) + ) + continue b; list.lanes |= renderLanes; dependency = list.alternate; null !== dependency && (dependency.lanes |= renderLanes); @@ -10903,6 +10940,17 @@ __DEV__ && workInProgress.flags |= 262144; } } + function checkIfSelectedContextValuesChanged( + oldComparedValue, + newComparedValue + ) { + if (isArrayImpl(oldComparedValue) && isArrayImpl(newComparedValue)) { + if (oldComparedValue.length !== newComparedValue.length) return !0; + for (var i = 0; i < oldComparedValue.length; i++) + if (!objectIs(newComparedValue[i], oldComparedValue[i])) return !0; + } else throw Error("Compared context values must be arrays"); + return !1; + } function checkIfContextChanged(currentDependencies) { if (!enableLazyContextPropagation) return !1; for ( @@ -10910,13 +10958,20 @@ __DEV__ && null !== currentDependencies; ) { + var newValue = currentDependencies.context._currentValue, + oldValue = currentDependencies.memoizedValue; if ( - !objectIs( - currentDependencies.context._currentValue, - currentDependencies.memoizedValue + null != currentDependencies.select && + null != currentDependencies.lastSelectedValue + ) { + if ( + checkIfSelectedContextValuesChanged( + currentDependencies.lastSelectedValue, + currentDependencies.select(newValue) + ) ) - ) - return !0; + return !0; + } else if (!objectIs(newValue, oldValue)) return !0; currentDependencies = currentDependencies.next; } return !1; @@ -24943,6 +24998,8 @@ __DEV__ && ContextOnlyDispatcher.useFormState = throwInvalidHookError; ContextOnlyDispatcher.useActionState = throwInvalidHookError; ContextOnlyDispatcher.useOptimistic = throwInvalidHookError; + ContextOnlyDispatcher.unstable_useContextWithBailout = + throwInvalidHookError; var HooksDispatcherOnMountInDEV = null, HooksDispatcherOnMountWithHookTypesInDEV = null, HooksDispatcherOnUpdateInDEV = null, @@ -25094,6 +25151,14 @@ __DEV__ && mountHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnMountInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + mountHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnMountWithHookTypesInDEV = { readContext: function (context) { return readContext(context); @@ -25239,6 +25304,12 @@ __DEV__ && updateHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnMountWithHookTypesInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnUpdateInDEV = { readContext: function (context) { return readContext(context); @@ -25377,6 +25448,14 @@ __DEV__ && updateHookTypesDev(); return updateOptimistic(passthrough, reducer); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnRerenderInDEV = { readContext: function (context) { return readContext(context); @@ -25515,6 +25594,14 @@ __DEV__ && updateHookTypesDev(); return rerenderOptimistic(passthrough, reducer); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnMountInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -25683,6 +25770,15 @@ __DEV__ && mountHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnUpdateInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -25848,6 +25944,13 @@ __DEV__ && updateHookTypesDev(); return updateOptimistic(passthrough, reducer); }; + InvalidNestedHooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnRerenderInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -26015,6 +26118,13 @@ __DEV__ && updateHookTypesDev(); return rerenderOptimistic(passthrough, reducer); }; + InvalidNestedHooksDispatcherOnRerenderInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; var now = Scheduler.unstable_now, commitTime = 0, layoutEffectStartTime = -1, @@ -27131,11 +27241,11 @@ __DEV__ && return_targetInst = null; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-www-modern-7f217d1d-20240725" !== isomorphicReactPackageVersion) + if ("19.0.0-www-modern-b9af819f-20240726" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-www-modern-7f217d1d-20240725\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-www-modern-b9af819f-20240726\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -27200,12 +27310,12 @@ __DEV__ && scheduleRoot: scheduleRoot, setRefreshHandler: setRefreshHandler, getCurrentFiber: getCurrentFiberForDevTools, - reconcilerVersion: "19.0.0-www-modern-7f217d1d-20240725" + reconcilerVersion: "19.0.0-www-modern-b9af819f-20240726" }); })({ findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 1, - version: "19.0.0-www-modern-7f217d1d-20240725", + version: "19.0.0-www-modern-b9af819f-20240726", rendererPackageName: "react-dom" }) && canUseDOM && @@ -27959,5 +28069,5 @@ __DEV__ && exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.0.0-www-modern-7f217d1d-20240725"; + exports.version = "19.0.0-www-modern-b9af819f-20240726"; })(); diff --git a/compiled/facebook-www/ReactDOMTesting-prod.classic.js b/compiled/facebook-www/ReactDOMTesting-prod.classic.js index bd9b84bc86864..302b9c40c052c 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.classic.js @@ -3536,6 +3536,29 @@ function updateWorkInProgressHook() { } return workInProgressHook; } +function unstable_useContextWithBailout(context, select) { + if (null === select) return readContext(context); + if (!enableLazyContextPropagation) throw Error(formatProdErrorMessage(248)); + var consumer = currentlyRenderingFiber, + value = context._currentValue; + if (lastFullyObservedContext !== context) + if ( + ((context = { + context: context, + memoizedValue: value, + next: null, + select: select, + lastSelectedValue: select(value) + }), + null === lastContextDependency) + ) { + if (null === consumer) throw Error(formatProdErrorMessage(308)); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + enableLazyContextPropagation && (consumer.flags |= 524288); + } else lastContextDependency = lastContextDependency.next = context; + return value; +} var createFunctionComponentUpdateQueue; createFunctionComponentUpdateQueue = function () { return { lastEffect: null, events: null, stores: null, memoCache: null }; @@ -4493,6 +4516,7 @@ ContextOnlyDispatcher.useHostTransitionStatus = throwInvalidHookError; ContextOnlyDispatcher.useFormState = throwInvalidHookError; ContextOnlyDispatcher.useActionState = throwInvalidHookError; ContextOnlyDispatcher.useOptimistic = throwInvalidHookError; +ContextOnlyDispatcher.unstable_useContextWithBailout = throwInvalidHookError; var HooksDispatcherOnMount = { readContext: readContext, use: use, @@ -4685,6 +4709,8 @@ HooksDispatcherOnMount.useOptimistic = function (passthrough) { queue.dispatch = hook; return [passthrough, hook]; }; +HooksDispatcherOnMount.unstable_useContextWithBailout = + unstable_useContextWithBailout; var HooksDispatcherOnUpdate = { readContext: readContext, use: use, @@ -4733,6 +4759,8 @@ HooksDispatcherOnUpdate.useOptimistic = function (passthrough, reducer) { var hook = updateWorkInProgressHook(); return updateOptimisticImpl(hook, currentHook, passthrough, reducer); }; +HooksDispatcherOnUpdate.unstable_useContextWithBailout = + unstable_useContextWithBailout; var HooksDispatcherOnRerender = { readContext: readContext, use: use, @@ -4786,6 +4814,8 @@ HooksDispatcherOnRerender.useOptimistic = function (passthrough, reducer) { hook.baseState = passthrough; return [passthrough, hook.queue.dispatch]; }; +HooksDispatcherOnRerender.unstable_useContextWithBailout = + unstable_useContextWithBailout; function applyDerivedStateFromProps( workInProgress, ctor, @@ -7515,8 +7545,19 @@ function propagateContextChanges( a: for (; null !== list; ) { var dependency = list; list = fiber; - for (var i = 0; i < contexts.length; i++) + var i = 0; + b: for (; i < contexts.length; i++) if (dependency.context === contexts[i]) { + var select = dependency.select; + if ( + null != select && + null != dependency.lastSelectedValue && + !checkIfSelectedContextValuesChanged( + dependency.lastSelectedValue, + select(dependency.context._currentValue) + ) + ) + continue b; list.lanes |= renderLanes; dependency = list.alternate; null !== dependency && (dependency.lanes |= renderLanes); @@ -7606,6 +7647,17 @@ function propagateParentContextChanges( workInProgress.flags |= 262144; } } +function checkIfSelectedContextValuesChanged( + oldComparedValue, + newComparedValue +) { + if (isArrayImpl(oldComparedValue) && isArrayImpl(newComparedValue)) { + if (oldComparedValue.length !== newComparedValue.length) return !0; + for (var i = 0; i < oldComparedValue.length; i++) + if (!objectIs(newComparedValue[i], oldComparedValue[i])) return !0; + } else throw Error(formatProdErrorMessage(541)); + return !1; +} function checkIfContextChanged(currentDependencies) { if (!enableLazyContextPropagation) return !1; for ( @@ -7613,13 +7665,20 @@ function checkIfContextChanged(currentDependencies) { null !== currentDependencies; ) { + var newValue = currentDependencies.context._currentValue, + oldValue = currentDependencies.memoizedValue; if ( - !objectIs( - currentDependencies.context._currentValue, - currentDependencies.memoizedValue + null != currentDependencies.select && + null != currentDependencies.lastSelectedValue + ) { + if ( + checkIfSelectedContextValuesChanged( + currentDependencies.lastSelectedValue, + currentDependencies.select(newValue) + ) ) - ) - return !0; + return !0; + } else if (!objectIs(newValue, oldValue)) return !0; currentDependencies = currentDependencies.next; } return !1; @@ -13468,19 +13527,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$391; + var JSCompiler_inline_result$jscomp$392; if (canUseDOM) { - var isSupported$jscomp$inline_1588 = "oninput" in document; - if (!isSupported$jscomp$inline_1588) { - var element$jscomp$inline_1589 = document.createElement("div"); - element$jscomp$inline_1589.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1588 = - "function" === typeof element$jscomp$inline_1589.oninput; + var isSupported$jscomp$inline_1592 = "oninput" in document; + if (!isSupported$jscomp$inline_1592) { + var element$jscomp$inline_1593 = document.createElement("div"); + element$jscomp$inline_1593.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1592 = + "function" === typeof element$jscomp$inline_1593.oninput; } - JSCompiler_inline_result$jscomp$391 = isSupported$jscomp$inline_1588; - } else JSCompiler_inline_result$jscomp$391 = !1; + JSCompiler_inline_result$jscomp$392 = isSupported$jscomp$inline_1592; + } else JSCompiler_inline_result$jscomp$392 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$391 && + JSCompiler_inline_result$jscomp$392 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -13891,20 +13950,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1629 = 0; - i$jscomp$inline_1629 < simpleEventPluginEvents.length; - i$jscomp$inline_1629++ + var i$jscomp$inline_1633 = 0; + i$jscomp$inline_1633 < simpleEventPluginEvents.length; + i$jscomp$inline_1633++ ) { - var eventName$jscomp$inline_1630 = - simpleEventPluginEvents[i$jscomp$inline_1629], - domEventName$jscomp$inline_1631 = - eventName$jscomp$inline_1630.toLowerCase(), - capitalizedEvent$jscomp$inline_1632 = - eventName$jscomp$inline_1630[0].toUpperCase() + - eventName$jscomp$inline_1630.slice(1); + var eventName$jscomp$inline_1634 = + simpleEventPluginEvents[i$jscomp$inline_1633], + domEventName$jscomp$inline_1635 = + eventName$jscomp$inline_1634.toLowerCase(), + capitalizedEvent$jscomp$inline_1636 = + eventName$jscomp$inline_1634[0].toUpperCase() + + eventName$jscomp$inline_1634.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1631, - "on" + capitalizedEvent$jscomp$inline_1632 + domEventName$jscomp$inline_1635, + "on" + capitalizedEvent$jscomp$inline_1636 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -17562,16 +17621,16 @@ function getCrossOriginStringAs(as, input) { if ("string" === typeof input) return "use-credentials" === input ? input : ""; } -var isomorphicReactPackageVersion$jscomp$inline_1802 = React.version; +var isomorphicReactPackageVersion$jscomp$inline_1806 = React.version; if ( - "19.0.0-www-classic-7f217d1d-20240725" !== - isomorphicReactPackageVersion$jscomp$inline_1802 + "19.0.0-www-classic-b9af819f-20240726" !== + isomorphicReactPackageVersion$jscomp$inline_1806 ) throw Error( formatProdErrorMessage( 527, - isomorphicReactPackageVersion$jscomp$inline_1802, - "19.0.0-www-classic-7f217d1d-20240725" + isomorphicReactPackageVersion$jscomp$inline_1806, + "19.0.0-www-classic-b9af819f-20240726" ) ); function flushSyncFromReconciler(fn) { @@ -17614,17 +17673,17 @@ Internals.Events = [ return fn(a); } ]; -var devToolsConfig$jscomp$inline_1809 = { +var devToolsConfig$jscomp$inline_1813 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-classic-7f217d1d-20240725", + version: "19.0.0-www-classic-b9af819f-20240726", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2246 = { - bundleType: devToolsConfig$jscomp$inline_1809.bundleType, - version: devToolsConfig$jscomp$inline_1809.version, - rendererPackageName: devToolsConfig$jscomp$inline_1809.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1809.rendererConfig, +var internals$jscomp$inline_2256 = { + bundleType: devToolsConfig$jscomp$inline_1813.bundleType, + version: devToolsConfig$jscomp$inline_1813.version, + rendererPackageName: devToolsConfig$jscomp$inline_1813.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1813.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -17640,26 +17699,26 @@ var internals$jscomp$inline_2246 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1809.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1813.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-classic-7f217d1d-20240725" + reconcilerVersion: "19.0.0-www-classic-b9af819f-20240726" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2247 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2257 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2247.isDisabled && - hook$jscomp$inline_2247.supportsFiber + !hook$jscomp$inline_2257.isDisabled && + hook$jscomp$inline_2257.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2247.inject( - internals$jscomp$inline_2246 + (rendererID = hook$jscomp$inline_2257.inject( + internals$jscomp$inline_2256 )), - (injectedHook = hook$jscomp$inline_2247); + (injectedHook = hook$jscomp$inline_2257); } catch (err) {} } function ReactDOMRoot(internalRoot) { @@ -18254,4 +18313,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-classic-7f217d1d-20240725"; +exports.version = "19.0.0-www-classic-b9af819f-20240726"; diff --git a/compiled/facebook-www/ReactDOMTesting-prod.modern.js b/compiled/facebook-www/ReactDOMTesting-prod.modern.js index 7da8a53bd906f..5634015c77688 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.modern.js @@ -3371,6 +3371,29 @@ function updateWorkInProgressHook() { } return workInProgressHook; } +function unstable_useContextWithBailout(context, select) { + if (null === select) return readContext(context); + if (!enableLazyContextPropagation) throw Error(formatProdErrorMessage(248)); + var consumer = currentlyRenderingFiber, + value = context._currentValue; + if (lastFullyObservedContext !== context) + if ( + ((context = { + context: context, + memoizedValue: value, + next: null, + select: select, + lastSelectedValue: select(value) + }), + null === lastContextDependency) + ) { + if (null === consumer) throw Error(formatProdErrorMessage(308)); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + enableLazyContextPropagation && (consumer.flags |= 524288); + } else lastContextDependency = lastContextDependency.next = context; + return value; +} var createFunctionComponentUpdateQueue; createFunctionComponentUpdateQueue = function () { return { lastEffect: null, events: null, stores: null, memoCache: null }; @@ -4328,6 +4351,7 @@ ContextOnlyDispatcher.useHostTransitionStatus = throwInvalidHookError; ContextOnlyDispatcher.useFormState = throwInvalidHookError; ContextOnlyDispatcher.useActionState = throwInvalidHookError; ContextOnlyDispatcher.useOptimistic = throwInvalidHookError; +ContextOnlyDispatcher.unstable_useContextWithBailout = throwInvalidHookError; var HooksDispatcherOnMount = { readContext: readContext, use: use, @@ -4520,6 +4544,8 @@ HooksDispatcherOnMount.useOptimistic = function (passthrough) { queue.dispatch = hook; return [passthrough, hook]; }; +HooksDispatcherOnMount.unstable_useContextWithBailout = + unstable_useContextWithBailout; var HooksDispatcherOnUpdate = { readContext: readContext, use: use, @@ -4568,6 +4594,8 @@ HooksDispatcherOnUpdate.useOptimistic = function (passthrough, reducer) { var hook = updateWorkInProgressHook(); return updateOptimisticImpl(hook, currentHook, passthrough, reducer); }; +HooksDispatcherOnUpdate.unstable_useContextWithBailout = + unstable_useContextWithBailout; var HooksDispatcherOnRerender = { readContext: readContext, use: use, @@ -4621,6 +4649,8 @@ HooksDispatcherOnRerender.useOptimistic = function (passthrough, reducer) { hook.baseState = passthrough; return [passthrough, hook.queue.dispatch]; }; +HooksDispatcherOnRerender.unstable_useContextWithBailout = + unstable_useContextWithBailout; function applyDerivedStateFromProps( workInProgress, ctor, @@ -7098,8 +7128,19 @@ function propagateContextChanges( a: for (; null !== list; ) { var dependency = list; list = fiber; - for (var i = 0; i < contexts.length; i++) + var i = 0; + b: for (; i < contexts.length; i++) if (dependency.context === contexts[i]) { + var select = dependency.select; + if ( + null != select && + null != dependency.lastSelectedValue && + !checkIfSelectedContextValuesChanged( + dependency.lastSelectedValue, + select(dependency.context._currentValue) + ) + ) + continue b; list.lanes |= renderLanes; dependency = list.alternate; null !== dependency && (dependency.lanes |= renderLanes); @@ -7189,6 +7230,17 @@ function propagateParentContextChanges( workInProgress.flags |= 262144; } } +function checkIfSelectedContextValuesChanged( + oldComparedValue, + newComparedValue +) { + if (isArrayImpl(oldComparedValue) && isArrayImpl(newComparedValue)) { + if (oldComparedValue.length !== newComparedValue.length) return !0; + for (var i = 0; i < oldComparedValue.length; i++) + if (!objectIs(newComparedValue[i], oldComparedValue[i])) return !0; + } else throw Error(formatProdErrorMessage(541)); + return !1; +} function checkIfContextChanged(currentDependencies) { if (!enableLazyContextPropagation) return !1; for ( @@ -7196,13 +7248,20 @@ function checkIfContextChanged(currentDependencies) { null !== currentDependencies; ) { + var newValue = currentDependencies.context._currentValue, + oldValue = currentDependencies.memoizedValue; if ( - !objectIs( - currentDependencies.context._currentValue, - currentDependencies.memoizedValue + null != currentDependencies.select && + null != currentDependencies.lastSelectedValue + ) { + if ( + checkIfSelectedContextValuesChanged( + currentDependencies.lastSelectedValue, + currentDependencies.select(newValue) + ) ) - ) - return !0; + return !0; + } else if (!objectIs(newValue, oldValue)) return !0; currentDependencies = currentDependencies.next; } return !1; @@ -12884,19 +12943,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$378; + var JSCompiler_inline_result$jscomp$379; if (canUseDOM) { - var isSupported$jscomp$inline_1559 = "oninput" in document; - if (!isSupported$jscomp$inline_1559) { - var element$jscomp$inline_1560 = document.createElement("div"); - element$jscomp$inline_1560.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1559 = - "function" === typeof element$jscomp$inline_1560.oninput; + var isSupported$jscomp$inline_1563 = "oninput" in document; + if (!isSupported$jscomp$inline_1563) { + var element$jscomp$inline_1564 = document.createElement("div"); + element$jscomp$inline_1564.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1563 = + "function" === typeof element$jscomp$inline_1564.oninput; } - JSCompiler_inline_result$jscomp$378 = isSupported$jscomp$inline_1559; - } else JSCompiler_inline_result$jscomp$378 = !1; + JSCompiler_inline_result$jscomp$379 = isSupported$jscomp$inline_1563; + } else JSCompiler_inline_result$jscomp$379 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$378 && + JSCompiler_inline_result$jscomp$379 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -13307,20 +13366,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1600 = 0; - i$jscomp$inline_1600 < simpleEventPluginEvents.length; - i$jscomp$inline_1600++ + var i$jscomp$inline_1604 = 0; + i$jscomp$inline_1604 < simpleEventPluginEvents.length; + i$jscomp$inline_1604++ ) { - var eventName$jscomp$inline_1601 = - simpleEventPluginEvents[i$jscomp$inline_1600], - domEventName$jscomp$inline_1602 = - eventName$jscomp$inline_1601.toLowerCase(), - capitalizedEvent$jscomp$inline_1603 = - eventName$jscomp$inline_1601[0].toUpperCase() + - eventName$jscomp$inline_1601.slice(1); + var eventName$jscomp$inline_1605 = + simpleEventPluginEvents[i$jscomp$inline_1604], + domEventName$jscomp$inline_1606 = + eventName$jscomp$inline_1605.toLowerCase(), + capitalizedEvent$jscomp$inline_1607 = + eventName$jscomp$inline_1605[0].toUpperCase() + + eventName$jscomp$inline_1605.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1602, - "on" + capitalizedEvent$jscomp$inline_1603 + domEventName$jscomp$inline_1606, + "on" + capitalizedEvent$jscomp$inline_1607 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -16927,16 +16986,16 @@ function getCrossOriginStringAs(as, input) { if ("string" === typeof input) return "use-credentials" === input ? input : ""; } -var isomorphicReactPackageVersion$jscomp$inline_1773 = React.version; +var isomorphicReactPackageVersion$jscomp$inline_1777 = React.version; if ( - "19.0.0-www-modern-7f217d1d-20240725" !== - isomorphicReactPackageVersion$jscomp$inline_1773 + "19.0.0-www-modern-b9af819f-20240726" !== + isomorphicReactPackageVersion$jscomp$inline_1777 ) throw Error( formatProdErrorMessage( 527, - isomorphicReactPackageVersion$jscomp$inline_1773, - "19.0.0-www-modern-7f217d1d-20240725" + isomorphicReactPackageVersion$jscomp$inline_1777, + "19.0.0-www-modern-b9af819f-20240726" ) ); Internals.findDOMNode = function (componentOrElement) { @@ -16952,17 +17011,17 @@ Internals.Events = [ return fn(a); } ]; -var devToolsConfig$jscomp$inline_1775 = { +var devToolsConfig$jscomp$inline_1779 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-modern-7f217d1d-20240725", + version: "19.0.0-www-modern-b9af819f-20240726", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2237 = { - bundleType: devToolsConfig$jscomp$inline_1775.bundleType, - version: devToolsConfig$jscomp$inline_1775.version, - rendererPackageName: devToolsConfig$jscomp$inline_1775.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1775.rendererConfig, +var internals$jscomp$inline_2247 = { + bundleType: devToolsConfig$jscomp$inline_1779.bundleType, + version: devToolsConfig$jscomp$inline_1779.version, + rendererPackageName: devToolsConfig$jscomp$inline_1779.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1779.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -16978,26 +17037,26 @@ var internals$jscomp$inline_2237 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1775.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1779.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-modern-7f217d1d-20240725" + reconcilerVersion: "19.0.0-www-modern-b9af819f-20240726" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2238 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2248 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2238.isDisabled && - hook$jscomp$inline_2238.supportsFiber + !hook$jscomp$inline_2248.isDisabled && + hook$jscomp$inline_2248.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2238.inject( - internals$jscomp$inline_2237 + (rendererID = hook$jscomp$inline_2248.inject( + internals$jscomp$inline_2247 )), - (injectedHook = hook$jscomp$inline_2238); + (injectedHook = hook$jscomp$inline_2248); } catch (err) {} } function ReactDOMRoot(internalRoot) { @@ -17499,4 +17558,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-modern-7f217d1d-20240725"; +exports.version = "19.0.0-www-modern-b9af819f-20240726"; diff --git a/compiled/facebook-www/ReactReconciler-dev.classic.js b/compiled/facebook-www/ReactReconciler-dev.classic.js index 6ed0726ccb951..7be1046634f16 100644 --- a/compiled/facebook-www/ReactReconciler-dev.classic.js +++ b/compiled/facebook-www/ReactReconciler-dev.classic.js @@ -4332,6 +4332,34 @@ __DEV__ && } return workInProgressHook; } + function unstable_useContextWithBailout(context, select) { + if (null === select) return readContext(context); + if (!enableLazyContextPropagation) throw Error("Not implemented."); + var consumer = currentlyRenderingFiber, + value = isPrimaryRenderer + ? context._currentValue + : context._currentValue2; + if (lastFullyObservedContext !== context) + if ( + ((context = { + context: context, + memoizedValue: value, + next: null, + select: select, + lastSelectedValue: select(value) + }), + null === lastContextDependency) + ) { + if (null === consumer) + throw Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + enableLazyContextPropagation && (consumer.flags |= 524288); + } else lastContextDependency = lastContextDependency.next = context; + return value; + } function useThenable(thenable) { var index = thenableIndexCounter; thenableIndexCounter += 1; @@ -9315,8 +9343,23 @@ __DEV__ && a: for (; null !== list; ) { var dependency = list; list = fiber; - for (var i = 0; i < contexts.length; i++) + var i = 0; + b: for (; i < contexts.length; i++) if (dependency.context === contexts[i]) { + var select = dependency.select; + if ( + null != select && + null != dependency.lastSelectedValue && + !checkIfSelectedContextValuesChanged( + dependency.lastSelectedValue, + select( + isPrimaryRenderer + ? dependency.context._currentValue + : dependency.context._currentValue2 + ) + ) + ) + continue b; list.lanes |= renderLanes; dependency = list.alternate; null !== dependency && (dependency.lanes |= renderLanes); @@ -9421,6 +9464,17 @@ __DEV__ && workInProgress.flags |= 262144; } } + function checkIfSelectedContextValuesChanged( + oldComparedValue, + newComparedValue + ) { + if (isArrayImpl(oldComparedValue) && isArrayImpl(newComparedValue)) { + if (oldComparedValue.length !== newComparedValue.length) return !0; + for (var i = 0; i < oldComparedValue.length; i++) + if (!objectIs(newComparedValue[i], oldComparedValue[i])) return !0; + } else throw Error("Compared context values must be arrays"); + return !1; + } function checkIfContextChanged(currentDependencies) { if (!enableLazyContextPropagation) return !1; for ( @@ -9429,13 +9483,22 @@ __DEV__ && ) { var context = currentDependencies.context; + context = isPrimaryRenderer + ? context._currentValue + : context._currentValue2; + var oldValue = currentDependencies.memoizedValue; if ( - !objectIs( - isPrimaryRenderer ? context._currentValue : context._currentValue2, - currentDependencies.memoizedValue + null != currentDependencies.select && + null != currentDependencies.lastSelectedValue + ) { + if ( + checkIfSelectedContextValuesChanged( + currentDependencies.lastSelectedValue, + currentDependencies.select(context) + ) ) - ) - return !0; + return !0; + } else if (!objectIs(context, oldValue)) return !0; currentDependencies = currentDependencies.next; } return !1; @@ -17189,6 +17252,8 @@ __DEV__ && ContextOnlyDispatcher.useFormState = throwInvalidHookError; ContextOnlyDispatcher.useActionState = throwInvalidHookError; ContextOnlyDispatcher.useOptimistic = throwInvalidHookError; + ContextOnlyDispatcher.unstable_useContextWithBailout = + throwInvalidHookError; var HooksDispatcherOnMountInDEV = null, HooksDispatcherOnMountWithHookTypesInDEV = null, HooksDispatcherOnUpdateInDEV = null, @@ -17340,6 +17405,14 @@ __DEV__ && mountHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnMountInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + mountHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnMountWithHookTypesInDEV = { readContext: function (context) { return readContext(context); @@ -17485,6 +17558,12 @@ __DEV__ && updateHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnMountWithHookTypesInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnUpdateInDEV = { readContext: function (context) { return readContext(context); @@ -17623,6 +17702,14 @@ __DEV__ && updateHookTypesDev(); return updateOptimistic(passthrough, reducer); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnRerenderInDEV = { readContext: function (context) { return readContext(context); @@ -17761,6 +17848,14 @@ __DEV__ && updateHookTypesDev(); return rerenderOptimistic(passthrough, reducer); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnMountInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -17929,6 +18024,15 @@ __DEV__ && mountHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnUpdateInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -18094,6 +18198,13 @@ __DEV__ && updateHookTypesDev(); return updateOptimistic(passthrough, reducer); }; + InvalidNestedHooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnRerenderInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -18261,6 +18372,13 @@ __DEV__ && updateHookTypesDev(); return rerenderOptimistic(passthrough, reducer); }; + InvalidNestedHooksDispatcherOnRerenderInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; var now = Scheduler.unstable_now, commitTime = 0, layoutEffectStartTime = -1, @@ -19155,7 +19273,7 @@ __DEV__ && scheduleRoot: scheduleRoot, setRefreshHandler: setRefreshHandler, getCurrentFiber: getCurrentFiberForDevTools, - reconcilerVersion: "19.0.0-www-classic-7f217d1d-20240725" + reconcilerVersion: "19.0.0-www-classic-b9af819f-20240726" }); }; exports.isAlreadyRendering = function () { diff --git a/compiled/facebook-www/ReactReconciler-dev.modern.js b/compiled/facebook-www/ReactReconciler-dev.modern.js index 7062aac2cdc4b..2db3da370b94e 100644 --- a/compiled/facebook-www/ReactReconciler-dev.modern.js +++ b/compiled/facebook-www/ReactReconciler-dev.modern.js @@ -4222,6 +4222,34 @@ __DEV__ && } return workInProgressHook; } + function unstable_useContextWithBailout(context, select) { + if (null === select) return readContext(context); + if (!enableLazyContextPropagation) throw Error("Not implemented."); + var consumer = currentlyRenderingFiber, + value = isPrimaryRenderer + ? context._currentValue + : context._currentValue2; + if (lastFullyObservedContext !== context) + if ( + ((context = { + context: context, + memoizedValue: value, + next: null, + select: select, + lastSelectedValue: select(value) + }), + null === lastContextDependency) + ) { + if (null === consumer) + throw Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + enableLazyContextPropagation && (consumer.flags |= 524288); + } else lastContextDependency = lastContextDependency.next = context; + return value; + } function useThenable(thenable) { var index = thenableIndexCounter; thenableIndexCounter += 1; @@ -8947,8 +8975,23 @@ __DEV__ && a: for (; null !== list; ) { var dependency = list; list = fiber; - for (var i = 0; i < contexts.length; i++) + var i = 0; + b: for (; i < contexts.length; i++) if (dependency.context === contexts[i]) { + var select = dependency.select; + if ( + null != select && + null != dependency.lastSelectedValue && + !checkIfSelectedContextValuesChanged( + dependency.lastSelectedValue, + select( + isPrimaryRenderer + ? dependency.context._currentValue + : dependency.context._currentValue2 + ) + ) + ) + continue b; list.lanes |= renderLanes; dependency = list.alternate; null !== dependency && (dependency.lanes |= renderLanes); @@ -9053,6 +9096,17 @@ __DEV__ && workInProgress.flags |= 262144; } } + function checkIfSelectedContextValuesChanged( + oldComparedValue, + newComparedValue + ) { + if (isArrayImpl(oldComparedValue) && isArrayImpl(newComparedValue)) { + if (oldComparedValue.length !== newComparedValue.length) return !0; + for (var i = 0; i < oldComparedValue.length; i++) + if (!objectIs(newComparedValue[i], oldComparedValue[i])) return !0; + } else throw Error("Compared context values must be arrays"); + return !1; + } function checkIfContextChanged(currentDependencies) { if (!enableLazyContextPropagation) return !1; for ( @@ -9061,13 +9115,22 @@ __DEV__ && ) { var context = currentDependencies.context; + context = isPrimaryRenderer + ? context._currentValue + : context._currentValue2; + var oldValue = currentDependencies.memoizedValue; if ( - !objectIs( - isPrimaryRenderer ? context._currentValue : context._currentValue2, - currentDependencies.memoizedValue + null != currentDependencies.select && + null != currentDependencies.lastSelectedValue + ) { + if ( + checkIfSelectedContextValuesChanged( + currentDependencies.lastSelectedValue, + currentDependencies.select(context) + ) ) - ) - return !0; + return !0; + } else if (!objectIs(context, oldValue)) return !0; currentDependencies = currentDependencies.next; } return !1; @@ -16561,6 +16624,8 @@ __DEV__ && ContextOnlyDispatcher.useFormState = throwInvalidHookError; ContextOnlyDispatcher.useActionState = throwInvalidHookError; ContextOnlyDispatcher.useOptimistic = throwInvalidHookError; + ContextOnlyDispatcher.unstable_useContextWithBailout = + throwInvalidHookError; var HooksDispatcherOnMountInDEV = null, HooksDispatcherOnMountWithHookTypesInDEV = null, HooksDispatcherOnUpdateInDEV = null, @@ -16712,6 +16777,14 @@ __DEV__ && mountHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnMountInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + mountHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnMountWithHookTypesInDEV = { readContext: function (context) { return readContext(context); @@ -16857,6 +16930,12 @@ __DEV__ && updateHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnMountWithHookTypesInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnUpdateInDEV = { readContext: function (context) { return readContext(context); @@ -16995,6 +17074,14 @@ __DEV__ && updateHookTypesDev(); return updateOptimistic(passthrough, reducer); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; HooksDispatcherOnRerenderInDEV = { readContext: function (context) { return readContext(context); @@ -17133,6 +17220,14 @@ __DEV__ && updateHookTypesDev(); return rerenderOptimistic(passthrough, reducer); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnMountInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -17301,6 +17396,15 @@ __DEV__ && mountHookTypesDev(); return mountOptimistic(passthrough); }; + HooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = function ( + context, + select + ) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnUpdateInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -17466,6 +17570,13 @@ __DEV__ && updateHookTypesDev(); return updateOptimistic(passthrough, reducer); }; + InvalidNestedHooksDispatcherOnUpdateInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; InvalidNestedHooksDispatcherOnRerenderInDEV = { readContext: function (context) { warnInvalidContextAccess(); @@ -17633,6 +17744,13 @@ __DEV__ && updateHookTypesDev(); return rerenderOptimistic(passthrough, reducer); }; + InvalidNestedHooksDispatcherOnRerenderInDEV.unstable_useContextWithBailout = + function (context, select) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return unstable_useContextWithBailout(context, select); + }; var now = Scheduler.unstable_now, commitTime = 0, layoutEffectStartTime = -1, @@ -18513,7 +18631,7 @@ __DEV__ && scheduleRoot: scheduleRoot, setRefreshHandler: setRefreshHandler, getCurrentFiber: getCurrentFiberForDevTools, - reconcilerVersion: "19.0.0-www-modern-7f217d1d-20240725" + reconcilerVersion: "19.0.0-www-modern-b9af819f-20240726" }); }; exports.isAlreadyRendering = function () { diff --git a/compiled/facebook-www/ReactReconciler-prod.classic.js b/compiled/facebook-www/ReactReconciler-prod.classic.js index 6a552cc7dc8f1..51ad98f80e03e 100644 --- a/compiled/facebook-www/ReactReconciler-prod.classic.js +++ b/compiled/facebook-www/ReactReconciler-prod.classic.js @@ -2587,6 +2587,31 @@ module.exports = function ($$$config) { } return workInProgressHook; } + function unstable_useContextWithBailout(context, select) { + if (null === select) return readContext(context); + if (!enableLazyContextPropagation) throw Error(formatProdErrorMessage(248)); + var consumer = currentlyRenderingFiber, + value = isPrimaryRenderer + ? context._currentValue + : context._currentValue2; + if (lastFullyObservedContext !== context) + if ( + ((context = { + context: context, + memoizedValue: value, + next: null, + select: select, + lastSelectedValue: select(value) + }), + null === lastContextDependency) + ) { + if (null === consumer) throw Error(formatProdErrorMessage(308)); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + enableLazyContextPropagation && (consumer.flags |= 524288); + } else lastContextDependency = lastContextDependency.next = context; + return value; + } function useThenable(thenable) { var index = thenableIndexCounter; thenableIndexCounter += 1; @@ -6192,8 +6217,23 @@ module.exports = function ($$$config) { a: for (; null !== list; ) { var dependency = list; list = fiber; - for (var i = 0; i < contexts.length; i++) + var i = 0; + b: for (; i < contexts.length; i++) if (dependency.context === contexts[i]) { + var select = dependency.select; + if ( + null != select && + null != dependency.lastSelectedValue && + !checkIfSelectedContextValuesChanged( + dependency.lastSelectedValue, + select( + isPrimaryRenderer + ? dependency.context._currentValue + : dependency.context._currentValue2 + ) + ) + ) + continue b; list.lanes |= renderLanes; dependency = list.alternate; null !== dependency && (dependency.lanes |= renderLanes); @@ -6289,6 +6329,17 @@ module.exports = function ($$$config) { workInProgress.flags |= 262144; } } + function checkIfSelectedContextValuesChanged( + oldComparedValue, + newComparedValue + ) { + if (isArrayImpl(oldComparedValue) && isArrayImpl(newComparedValue)) { + if (oldComparedValue.length !== newComparedValue.length) return !0; + for (var i = 0; i < oldComparedValue.length; i++) + if (!objectIs(newComparedValue[i], oldComparedValue[i])) return !0; + } else throw Error(formatProdErrorMessage(541)); + return !1; + } function checkIfContextChanged(currentDependencies) { if (!enableLazyContextPropagation) return !1; for ( @@ -6297,13 +6348,22 @@ module.exports = function ($$$config) { ) { var context = currentDependencies.context; + context = isPrimaryRenderer + ? context._currentValue + : context._currentValue2; + var oldValue = currentDependencies.memoizedValue; if ( - !objectIs( - isPrimaryRenderer ? context._currentValue : context._currentValue2, - currentDependencies.memoizedValue + null != currentDependencies.select && + null != currentDependencies.lastSelectedValue + ) { + if ( + checkIfSelectedContextValuesChanged( + currentDependencies.lastSelectedValue, + currentDependencies.select(context) + ) ) - ) - return !0; + return !0; + } else if (!objectIs(context, oldValue)) return !0; currentDependencies = currentDependencies.next; } return !1; @@ -11863,6 +11923,7 @@ module.exports = function ($$$config) { ContextOnlyDispatcher.useFormState = throwInvalidHookError; ContextOnlyDispatcher.useActionState = throwInvalidHookError; ContextOnlyDispatcher.useOptimistic = throwInvalidHookError; + ContextOnlyDispatcher.unstable_useContextWithBailout = throwInvalidHookError; var HooksDispatcherOnMount = { readContext: readContext, use: use, @@ -12061,6 +12122,8 @@ module.exports = function ($$$config) { queue.dispatch = hook; return [passthrough, hook]; }; + HooksDispatcherOnMount.unstable_useContextWithBailout = + unstable_useContextWithBailout; var HooksDispatcherOnUpdate = { readContext: readContext, use: use, @@ -12109,6 +12172,8 @@ module.exports = function ($$$config) { var hook = updateWorkInProgressHook(); return updateOptimisticImpl(hook, currentHook, passthrough, reducer); }; + HooksDispatcherOnUpdate.unstable_useContextWithBailout = + unstable_useContextWithBailout; var HooksDispatcherOnRerender = { readContext: readContext, use: use, @@ -12162,6 +12227,8 @@ module.exports = function ($$$config) { hook.baseState = passthrough; return [passthrough, hook.queue.dispatch]; }; + HooksDispatcherOnRerender.unstable_useContextWithBailout = + unstable_useContextWithBailout; var classComponentUpdater = { isMounted: function (component) { return (component = component._reactInternals) @@ -12736,7 +12803,7 @@ module.exports = function ($$$config) { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-classic-7f217d1d-20240725" + reconcilerVersion: "19.0.0-www-classic-b9af819f-20240726" }; if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) devToolsConfig = !1; diff --git a/compiled/facebook-www/ReactReconciler-prod.modern.js b/compiled/facebook-www/ReactReconciler-prod.modern.js index a52d2469a5410..a8a6d6e41d86f 100644 --- a/compiled/facebook-www/ReactReconciler-prod.modern.js +++ b/compiled/facebook-www/ReactReconciler-prod.modern.js @@ -2438,6 +2438,31 @@ module.exports = function ($$$config) { } return workInProgressHook; } + function unstable_useContextWithBailout(context, select) { + if (null === select) return readContext(context); + if (!enableLazyContextPropagation) throw Error(formatProdErrorMessage(248)); + var consumer = currentlyRenderingFiber, + value = isPrimaryRenderer + ? context._currentValue + : context._currentValue2; + if (lastFullyObservedContext !== context) + if ( + ((context = { + context: context, + memoizedValue: value, + next: null, + select: select, + lastSelectedValue: select(value) + }), + null === lastContextDependency) + ) { + if (null === consumer) throw Error(formatProdErrorMessage(308)); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + enableLazyContextPropagation && (consumer.flags |= 524288); + } else lastContextDependency = lastContextDependency.next = context; + return value; + } function useThenable(thenable) { var index = thenableIndexCounter; thenableIndexCounter += 1; @@ -5813,8 +5838,23 @@ module.exports = function ($$$config) { a: for (; null !== list; ) { var dependency = list; list = fiber; - for (var i = 0; i < contexts.length; i++) + var i = 0; + b: for (; i < contexts.length; i++) if (dependency.context === contexts[i]) { + var select = dependency.select; + if ( + null != select && + null != dependency.lastSelectedValue && + !checkIfSelectedContextValuesChanged( + dependency.lastSelectedValue, + select( + isPrimaryRenderer + ? dependency.context._currentValue + : dependency.context._currentValue2 + ) + ) + ) + continue b; list.lanes |= renderLanes; dependency = list.alternate; null !== dependency && (dependency.lanes |= renderLanes); @@ -5910,6 +5950,17 @@ module.exports = function ($$$config) { workInProgress.flags |= 262144; } } + function checkIfSelectedContextValuesChanged( + oldComparedValue, + newComparedValue + ) { + if (isArrayImpl(oldComparedValue) && isArrayImpl(newComparedValue)) { + if (oldComparedValue.length !== newComparedValue.length) return !0; + for (var i = 0; i < oldComparedValue.length; i++) + if (!objectIs(newComparedValue[i], oldComparedValue[i])) return !0; + } else throw Error(formatProdErrorMessage(541)); + return !1; + } function checkIfContextChanged(currentDependencies) { if (!enableLazyContextPropagation) return !1; for ( @@ -5918,13 +5969,22 @@ module.exports = function ($$$config) { ) { var context = currentDependencies.context; + context = isPrimaryRenderer + ? context._currentValue + : context._currentValue2; + var oldValue = currentDependencies.memoizedValue; if ( - !objectIs( - isPrimaryRenderer ? context._currentValue : context._currentValue2, - currentDependencies.memoizedValue + null != currentDependencies.select && + null != currentDependencies.lastSelectedValue + ) { + if ( + checkIfSelectedContextValuesChanged( + currentDependencies.lastSelectedValue, + currentDependencies.select(context) + ) ) - ) - return !0; + return !0; + } else if (!objectIs(context, oldValue)) return !0; currentDependencies = currentDependencies.next; } return !1; @@ -11365,6 +11425,7 @@ module.exports = function ($$$config) { ContextOnlyDispatcher.useFormState = throwInvalidHookError; ContextOnlyDispatcher.useActionState = throwInvalidHookError; ContextOnlyDispatcher.useOptimistic = throwInvalidHookError; + ContextOnlyDispatcher.unstable_useContextWithBailout = throwInvalidHookError; var HooksDispatcherOnMount = { readContext: readContext, use: use, @@ -11563,6 +11624,8 @@ module.exports = function ($$$config) { queue.dispatch = hook; return [passthrough, hook]; }; + HooksDispatcherOnMount.unstable_useContextWithBailout = + unstable_useContextWithBailout; var HooksDispatcherOnUpdate = { readContext: readContext, use: use, @@ -11611,6 +11674,8 @@ module.exports = function ($$$config) { var hook = updateWorkInProgressHook(); return updateOptimisticImpl(hook, currentHook, passthrough, reducer); }; + HooksDispatcherOnUpdate.unstable_useContextWithBailout = + unstable_useContextWithBailout; var HooksDispatcherOnRerender = { readContext: readContext, use: use, @@ -11664,6 +11729,8 @@ module.exports = function ($$$config) { hook.baseState = passthrough; return [passthrough, hook.queue.dispatch]; }; + HooksDispatcherOnRerender.unstable_useContextWithBailout = + unstable_useContextWithBailout; var classComponentUpdater = { isMounted: function (component) { return (component = component._reactInternals) @@ -12225,7 +12292,7 @@ module.exports = function ($$$config) { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-modern-7f217d1d-20240725" + reconcilerVersion: "19.0.0-www-modern-b9af819f-20240726" }; if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) devToolsConfig = !1; diff --git a/compiled/facebook-www/ReactTestRenderer-dev.classic.js b/compiled/facebook-www/ReactTestRenderer-dev.classic.js index 482b62d89905c..94812f8151c9b 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.classic.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.classic.js @@ -14851,14 +14851,14 @@ __DEV__ && scheduleRoot: scheduleRoot, setRefreshHandler: setRefreshHandler, getCurrentFiber: getCurrentFiberForDevTools, - reconcilerVersion: "19.0.0-www-classic-7f217d1d-20240725" + reconcilerVersion: "19.0.0-www-classic-b9af819f-20240726" }); })({ findFiberByHostInstance: function () { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 1, - version: "19.0.0-www-classic-7f217d1d-20240725", + version: "19.0.0-www-classic-b9af819f-20240726", rendererPackageName: "react-test-renderer" }); exports._Scheduler = Scheduler; diff --git a/compiled/facebook-www/ReactTestRenderer-dev.modern.js b/compiled/facebook-www/ReactTestRenderer-dev.modern.js index f2297416cf1e8..6d453ad6744dc 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.modern.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.modern.js @@ -14851,14 +14851,14 @@ __DEV__ && scheduleRoot: scheduleRoot, setRefreshHandler: setRefreshHandler, getCurrentFiber: getCurrentFiberForDevTools, - reconcilerVersion: "19.0.0-www-modern-7f217d1d-20240725" + reconcilerVersion: "19.0.0-www-modern-b9af819f-20240726" }); })({ findFiberByHostInstance: function () { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 1, - version: "19.0.0-www-modern-7f217d1d-20240725", + version: "19.0.0-www-modern-b9af819f-20240726", rendererPackageName: "react-test-renderer" }); exports._Scheduler = Scheduler; diff --git a/compiled/facebook-www/VERSION_CLASSIC b/compiled/facebook-www/VERSION_CLASSIC index 40c9235ea9ab6..4251c3c7ddc80 100644 --- a/compiled/facebook-www/VERSION_CLASSIC +++ b/compiled/facebook-www/VERSION_CLASSIC @@ -1 +1 @@ -19.0.0-www-classic-7f217d1d-20240725 \ No newline at end of file +19.0.0-www-classic-b9af819f-20240726 \ No newline at end of file diff --git a/compiled/facebook-www/VERSION_MODERN b/compiled/facebook-www/VERSION_MODERN index f94708b04ac51..64c2a3ed71e64 100644 --- a/compiled/facebook-www/VERSION_MODERN +++ b/compiled/facebook-www/VERSION_MODERN @@ -1 +1 @@ -19.0.0-www-modern-7f217d1d-20240725 \ No newline at end of file +19.0.0-www-modern-b9af819f-20240726 \ No newline at end of file