From cda4f89f40210cc342af94d101cf4068032d45bd Mon Sep 17 00:00:00 2001 From: acdlite Date: Thu, 13 Apr 2023 19:26:30 +0000 Subject: [PATCH] Synchronously flush the transition lane scheduled in a popstate event (#26025) ## Summary Browsers restore state like forms and scroll position right after the popstate event. To make sure the page work as expected on back or forward button, we need to flush transitions scheduled in a popstate synchronously, and only yields if it suspends. This PR adds a new HostConfig method to check if `window.event === 'popstate'`, and `scheduleMicrotask` if a transition is scheduled in a `PopStateEvent`. ## How did you test this change? yarn test DiffTrain build for [d121c67004a2e6b0bb5d341843663ef213f64863](https://github.com/facebook/react/commit/d121c67004a2e6b0bb5d341843663ef213f64863) --- compiled/facebook-www/REVISION | 2 +- compiled/facebook-www/React-dev.modern.js | 2 +- compiled/facebook-www/ReactART-dev.classic.js | 34 ++++++-- compiled/facebook-www/ReactART-dev.modern.js | 34 ++++++-- .../facebook-www/ReactART-prod.classic.js | 38 ++++---- compiled/facebook-www/ReactART-prod.modern.js | 38 ++++---- compiled/facebook-www/ReactDOM-dev.classic.js | 34 ++++++-- compiled/facebook-www/ReactDOM-dev.modern.js | 34 ++++++-- .../facebook-www/ReactDOM-prod.classic.js | 86 ++++++++++--------- compiled/facebook-www/ReactDOM-prod.modern.js | 86 ++++++++++--------- .../ReactDOM-profiling.classic.js | 72 ++++++++-------- .../facebook-www/ReactDOM-profiling.modern.js | 72 ++++++++-------- .../ReactDOMTesting-dev.classic.js | 34 ++++++-- .../ReactDOMTesting-dev.modern.js | 34 ++++++-- .../ReactDOMTesting-prod.classic.js | 86 ++++++++++--------- .../ReactDOMTesting-prod.modern.js | 86 ++++++++++--------- .../ReactTestRenderer-dev.classic.js | 34 ++++++-- .../ReactTestRenderer-dev.modern.js | 34 ++++++-- 18 files changed, 504 insertions(+), 336 deletions(-) diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index ad3e1c7bf7..567094c26f 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -7b0642bb989ec659c6c9891ea16daa0420caab4d +d121c67004a2e6b0bb5d341843663ef213f64863 diff --git a/compiled/facebook-www/React-dev.modern.js b/compiled/facebook-www/React-dev.modern.js index 7bb38d3f4e..fdbdf769e3 100644 --- a/compiled/facebook-www/React-dev.modern.js +++ b/compiled/facebook-www/React-dev.modern.js @@ -27,7 +27,7 @@ if ( } "use strict"; -var ReactVersion = "18.3.0-www-modern-50a23993"; +var ReactVersion = "18.3.0-www-modern-40ddfb33"; // ATTENTION // When adding new symbols to this file, diff --git a/compiled/facebook-www/ReactART-dev.classic.js b/compiled/facebook-www/ReactART-dev.classic.js index 088299b8f6..a38dd83ade 100644 --- a/compiled/facebook-www/ReactART-dev.classic.js +++ b/compiled/facebook-www/ReactART-dev.classic.js @@ -69,7 +69,7 @@ function _assertThisInitialized(self) { return self; } -var ReactVersion = "18.3.0-www-classic-4e76503d"; +var ReactVersion = "18.3.0-www-classic-09c9197a"; var LegacyRoot = 0; var ConcurrentRoot = 1; @@ -2836,6 +2836,9 @@ function shouldSetTextContent(type, props) { } function getCurrentEventPriority() { return DefaultEventPriority; +} +function shouldAttemptEagerTransition() { + return false; } // The ART renderer is secondary to the React DOM renderer. var warnsIfNotActing = false; @@ -23095,6 +23098,7 @@ var didScheduleMicrotask_act = false; // Used to quickly bail out of flushSync i var mightHavePendingSyncWork = false; var isFlushingWork = false; +var currentEventTransitionLane = NoLanes; function ensureRootIsScheduled(root) { // This function is called whenever a root receives an update. It does two // things 1) it ensures the root is in the root schedule, and 2) it ensures @@ -23253,6 +23257,14 @@ function processRootScheduleInMicrotask() { while (root !== null) { var next = root.next; + + if ( + currentEventTransitionLane !== NoLane && + shouldAttemptEagerTransition() + ) { + markRootEntangled(root, mergeLanes(currentEventTransitionLane, SyncLane)); + } + var nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); if (nextLanes === NoLane) { @@ -23284,7 +23296,9 @@ function processRootScheduleInMicrotask() { } root = next; - } // At the end of the microtask, flush any pending synchronous work. This has + } + + currentEventTransitionLane = NoLane; // At the end of the microtask, flush any pending synchronous work. This has // to come at the end, because it does actual rendering work that might throw. flushSyncWorkOnAllRoots(); @@ -23457,6 +23471,13 @@ function scheduleImmediateTask(cb) { } } +function getCurrentEventTransitionLane() { + return currentEventTransitionLane; +} +function setCurrentEventTransitionLane(lane) { + currentEventTransitionLane = lane; +} + var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map; var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, @@ -23722,7 +23743,6 @@ var didScheduleUpdateDuringPassiveEffects = false; var NESTED_PASSIVE_UPDATE_LIMIT = 50; var nestedPassiveUpdateCount = 0; var rootWithPassiveNestedUpdates = null; -var currentEventTransitionLane = NoLanes; var isRunningInsertionEffect = false; function getWorkInProgressRoot() { return workInProgressRoot; @@ -23774,12 +23794,12 @@ function requestUpdateLane(fiber) { // event. Then reset the cached values once we can be sure the event is // over. Our heuristic for that is whenever we enter a concurrent work loop. - if (currentEventTransitionLane === NoLane) { + if (getCurrentEventTransitionLane() === NoLane) { // All transitions within the same event are assigned the same lane. - currentEventTransitionLane = claimNextTransitionLane(); + setCurrentEventTransitionLane(claimNextTransitionLane()); } - return currentEventTransitionLane; + return getCurrentEventTransitionLane(); } // Updates originating inside certain React methods, like flushSync, have // their priority set by tracking it with a context variable. // @@ -23956,8 +23976,6 @@ function performConcurrentWorkOnRoot(root, didTimeout) { resetNestedUpdateFlag(); } - currentEventTransitionLane = NoLanes; - if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { throw new Error("Should not already be working."); } // Flush any pending passive effects before deciding which lanes to work on, diff --git a/compiled/facebook-www/ReactART-dev.modern.js b/compiled/facebook-www/ReactART-dev.modern.js index eed24ab68d..80c5f3b9f7 100644 --- a/compiled/facebook-www/ReactART-dev.modern.js +++ b/compiled/facebook-www/ReactART-dev.modern.js @@ -69,7 +69,7 @@ function _assertThisInitialized(self) { return self; } -var ReactVersion = "18.3.0-www-modern-f2fcb129"; +var ReactVersion = "18.3.0-www-modern-c0c3e536"; var LegacyRoot = 0; var ConcurrentRoot = 1; @@ -2833,6 +2833,9 @@ function shouldSetTextContent(type, props) { } function getCurrentEventPriority() { return DefaultEventPriority; +} +function shouldAttemptEagerTransition() { + return false; } // The ART renderer is secondary to the React DOM renderer. var warnsIfNotActing = false; @@ -22760,6 +22763,7 @@ var didScheduleMicrotask_act = false; // Used to quickly bail out of flushSync i var mightHavePendingSyncWork = false; var isFlushingWork = false; +var currentEventTransitionLane = NoLanes; function ensureRootIsScheduled(root) { // This function is called whenever a root receives an update. It does two // things 1) it ensures the root is in the root schedule, and 2) it ensures @@ -22918,6 +22922,14 @@ function processRootScheduleInMicrotask() { while (root !== null) { var next = root.next; + + if ( + currentEventTransitionLane !== NoLane && + shouldAttemptEagerTransition() + ) { + markRootEntangled(root, mergeLanes(currentEventTransitionLane, SyncLane)); + } + var nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); if (nextLanes === NoLane) { @@ -22949,7 +22961,9 @@ function processRootScheduleInMicrotask() { } root = next; - } // At the end of the microtask, flush any pending synchronous work. This has + } + + currentEventTransitionLane = NoLane; // At the end of the microtask, flush any pending synchronous work. This has // to come at the end, because it does actual rendering work that might throw. flushSyncWorkOnAllRoots(); @@ -23122,6 +23136,13 @@ function scheduleImmediateTask(cb) { } } +function getCurrentEventTransitionLane() { + return currentEventTransitionLane; +} +function setCurrentEventTransitionLane(lane) { + currentEventTransitionLane = lane; +} + var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map; var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, @@ -23387,7 +23408,6 @@ var didScheduleUpdateDuringPassiveEffects = false; var NESTED_PASSIVE_UPDATE_LIMIT = 50; var nestedPassiveUpdateCount = 0; var rootWithPassiveNestedUpdates = null; -var currentEventTransitionLane = NoLanes; var isRunningInsertionEffect = false; function getWorkInProgressRoot() { return workInProgressRoot; @@ -23439,12 +23459,12 @@ function requestUpdateLane(fiber) { // event. Then reset the cached values once we can be sure the event is // over. Our heuristic for that is whenever we enter a concurrent work loop. - if (currentEventTransitionLane === NoLane) { + if (getCurrentEventTransitionLane() === NoLane) { // All transitions within the same event are assigned the same lane. - currentEventTransitionLane = claimNextTransitionLane(); + setCurrentEventTransitionLane(claimNextTransitionLane()); } - return currentEventTransitionLane; + return getCurrentEventTransitionLane(); } // Updates originating inside certain React methods, like flushSync, have // their priority set by tracking it with a context variable. // @@ -23621,8 +23641,6 @@ function performConcurrentWorkOnRoot(root, didTimeout) { resetNestedUpdateFlag(); } - currentEventTransitionLane = NoLanes; - if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { throw new Error("Should not already be working."); } // Flush any pending passive effects before deciding which lanes to work on, diff --git a/compiled/facebook-www/ReactART-prod.classic.js b/compiled/facebook-www/ReactART-prod.classic.js index a7b188c103..7e2b142353 100644 --- a/compiled/facebook-www/ReactART-prod.classic.js +++ b/compiled/facebook-www/ReactART-prod.classic.js @@ -7655,7 +7655,8 @@ var DefaultCacheDispatcher = { lastScheduledRoot = null, didScheduleMicrotask = !1, mightHavePendingSyncWork = !1, - isFlushingWork = !1; + isFlushingWork = !1, + currentEventTransitionLane = 0; function ensureRootIsScheduled(root) { root !== lastScheduledRoot && null === root.next && @@ -7774,6 +7775,7 @@ function processRootScheduleInMicrotask() { 0 !== (nextLanes & 3) && (mightHavePendingSyncWork = !0)); root = next; } + currentEventTransitionLane = 0; flushSyncWorkAcrossRoots_impl(!1); } function scheduleTaskForRootDuringMicrotask(root, currentTime) { @@ -7942,8 +7944,7 @@ var hasUncaughtError = !1, pendingPassiveEffectsRemainingLanes = 0, pendingPassiveTransitions = null, nestedUpdateCount = 0, - rootWithNestedUpdates = null, - currentEventTransitionLane = 0; + rootWithNestedUpdates = null; function requestUpdateLane(fiber) { if (0 === (fiber.mode & 1)) return 2; if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) @@ -7996,7 +7997,6 @@ function scheduleUpdateOnFiber(root, fiber, lane) { } } function performConcurrentWorkOnRoot(root, didTimeout) { - currentEventTransitionLane = 0; if (0 !== (executionContext & 6)) throw Error(formatProdErrorMessage(327)); var originalCallbackNode = root.callbackNode; if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) @@ -9967,19 +9967,19 @@ var slice = Array.prototype.slice, }; return Text; })(React.Component), - devToolsConfig$jscomp$inline_1170 = { + devToolsConfig$jscomp$inline_1172 = { findFiberByHostInstance: function () { return null; }, bundleType: 0, - version: "18.3.0-www-classic-3d4daf47", + version: "18.3.0-www-classic-4755ac8c", rendererPackageName: "react-art" }; -var internals$jscomp$inline_1335 = { - bundleType: devToolsConfig$jscomp$inline_1170.bundleType, - version: devToolsConfig$jscomp$inline_1170.version, - rendererPackageName: devToolsConfig$jscomp$inline_1170.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1170.rendererConfig, +var internals$jscomp$inline_1337 = { + bundleType: devToolsConfig$jscomp$inline_1172.bundleType, + version: devToolsConfig$jscomp$inline_1172.version, + rendererPackageName: devToolsConfig$jscomp$inline_1172.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1172.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -9996,26 +9996,26 @@ var internals$jscomp$inline_1335 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1170.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1172.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-3d4daf47" + reconcilerVersion: "18.3.0-www-classic-4755ac8c" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1336 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1338 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1336.isDisabled && - hook$jscomp$inline_1336.supportsFiber + !hook$jscomp$inline_1338.isDisabled && + hook$jscomp$inline_1338.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1336.inject( - internals$jscomp$inline_1335 + (rendererID = hook$jscomp$inline_1338.inject( + internals$jscomp$inline_1337 )), - (injectedHook = hook$jscomp$inline_1336); + (injectedHook = hook$jscomp$inline_1338); } 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 699ea56cb5..26b0f48b81 100644 --- a/compiled/facebook-www/ReactART-prod.modern.js +++ b/compiled/facebook-www/ReactART-prod.modern.js @@ -7391,7 +7391,8 @@ var DefaultCacheDispatcher = { lastScheduledRoot = null, didScheduleMicrotask = !1, mightHavePendingSyncWork = !1, - isFlushingWork = !1; + isFlushingWork = !1, + currentEventTransitionLane = 0; function ensureRootIsScheduled(root) { root !== lastScheduledRoot && null === root.next && @@ -7510,6 +7511,7 @@ function processRootScheduleInMicrotask() { 0 !== (nextLanes & 3) && (mightHavePendingSyncWork = !0)); root = next; } + currentEventTransitionLane = 0; flushSyncWorkAcrossRoots_impl(!1); } function scheduleTaskForRootDuringMicrotask(root, currentTime) { @@ -7678,8 +7680,7 @@ var hasUncaughtError = !1, pendingPassiveEffectsRemainingLanes = 0, pendingPassiveTransitions = null, nestedUpdateCount = 0, - rootWithNestedUpdates = null, - currentEventTransitionLane = 0; + rootWithNestedUpdates = null; function requestUpdateLane(fiber) { if (0 === (fiber.mode & 1)) return 2; if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) @@ -7732,7 +7733,6 @@ function scheduleUpdateOnFiber(root, fiber, lane) { } } function performConcurrentWorkOnRoot(root, didTimeout) { - currentEventTransitionLane = 0; if (0 !== (executionContext & 6)) throw Error(formatProdErrorMessage(327)); var originalCallbackNode = root.callbackNode; if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) @@ -9632,19 +9632,19 @@ var slice = Array.prototype.slice, }; return Text; })(React.Component), - devToolsConfig$jscomp$inline_1150 = { + devToolsConfig$jscomp$inline_1152 = { findFiberByHostInstance: function () { return null; }, bundleType: 0, - version: "18.3.0-www-modern-f611b8f0", + version: "18.3.0-www-modern-342727fc", rendererPackageName: "react-art" }; -var internals$jscomp$inline_1315 = { - bundleType: devToolsConfig$jscomp$inline_1150.bundleType, - version: devToolsConfig$jscomp$inline_1150.version, - rendererPackageName: devToolsConfig$jscomp$inline_1150.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1150.rendererConfig, +var internals$jscomp$inline_1317 = { + bundleType: devToolsConfig$jscomp$inline_1152.bundleType, + version: devToolsConfig$jscomp$inline_1152.version, + rendererPackageName: devToolsConfig$jscomp$inline_1152.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1152.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -9661,26 +9661,26 @@ var internals$jscomp$inline_1315 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1150.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1152.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-f611b8f0" + reconcilerVersion: "18.3.0-www-modern-342727fc" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1316 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1318 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1316.isDisabled && - hook$jscomp$inline_1316.supportsFiber + !hook$jscomp$inline_1318.isDisabled && + hook$jscomp$inline_1318.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1316.inject( - internals$jscomp$inline_1315 + (rendererID = hook$jscomp$inline_1318.inject( + internals$jscomp$inline_1317 )), - (injectedHook = hook$jscomp$inline_1316); + (injectedHook = hook$jscomp$inline_1318); } 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 ff73f81ec9..b7033ac47d 100644 --- a/compiled/facebook-www/ReactDOM-dev.classic.js +++ b/compiled/facebook-www/ReactDOM-dev.classic.js @@ -28595,6 +28595,7 @@ var didScheduleMicrotask_act = false; // Used to quickly bail out of flushSync i var mightHavePendingSyncWork = false; var isFlushingWork = false; +var currentEventTransitionLane = NoLanes; function ensureRootIsScheduled(root) { // This function is called whenever a root receives an update. It does two // things 1) it ensures the root is in the root schedule, and 2) it ensures @@ -28753,6 +28754,14 @@ function processRootScheduleInMicrotask() { while (root !== null) { var next = root.next; + + if ( + currentEventTransitionLane !== NoLane && + shouldAttemptEagerTransition() + ) { + markRootEntangled(root, mergeLanes(currentEventTransitionLane, SyncLane)); + } + var nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); if (nextLanes === NoLane) { @@ -28784,7 +28793,9 @@ function processRootScheduleInMicrotask() { } root = next; - } // At the end of the microtask, flush any pending synchronous work. This has + } + + currentEventTransitionLane = NoLane; // At the end of the microtask, flush any pending synchronous work. This has // to come at the end, because it does actual rendering work that might throw. flushSyncWorkOnAllRoots(); @@ -28975,6 +28986,13 @@ function scheduleImmediateTask(cb) { } } +function getCurrentEventTransitionLane() { + return currentEventTransitionLane; +} +function setCurrentEventTransitionLane(lane) { + currentEventTransitionLane = lane; +} + var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map; var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, @@ -29240,7 +29258,6 @@ var didScheduleUpdateDuringPassiveEffects = false; var NESTED_PASSIVE_UPDATE_LIMIT = 50; var nestedPassiveUpdateCount = 0; var rootWithPassiveNestedUpdates = null; -var currentEventTransitionLane = NoLanes; var isRunningInsertionEffect = false; function getWorkInProgressRoot() { return workInProgressRoot; @@ -29292,12 +29309,12 @@ function requestUpdateLane(fiber) { // event. Then reset the cached values once we can be sure the event is // over. Our heuristic for that is whenever we enter a concurrent work loop. - if (currentEventTransitionLane === NoLane) { + if (getCurrentEventTransitionLane() === NoLane) { // All transitions within the same event are assigned the same lane. - currentEventTransitionLane = claimNextTransitionLane(); + setCurrentEventTransitionLane(claimNextTransitionLane()); } - return currentEventTransitionLane; + return getCurrentEventTransitionLane(); } // Updates originating inside certain React methods, like flushSync, have // their priority set by tracking it with a context variable. // @@ -29489,8 +29506,6 @@ function performConcurrentWorkOnRoot(root, didTimeout) { resetNestedUpdateFlag(); } - currentEventTransitionLane = NoLanes; - if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { throw new Error("Should not already be working."); } // Flush any pending passive effects before deciding which lanes to work on, @@ -33721,7 +33736,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-826fd32d"; +var ReactVersion = "18.3.0-www-classic-ffb509af"; function createPortal$1( children, @@ -41986,6 +42001,9 @@ function getCurrentEventPriority() { return getEventPriority(currentEvent.type); } +function shouldAttemptEagerTransition() { + return window.event && window.event.type === "popstate"; +} // if a component just imports ReactDOM (e.g. for findDOMNode). // Some environments might not have setTimeout or clearTimeout. diff --git a/compiled/facebook-www/ReactDOM-dev.modern.js b/compiled/facebook-www/ReactDOM-dev.modern.js index c339806018..9d879e5c0f 100644 --- a/compiled/facebook-www/ReactDOM-dev.modern.js +++ b/compiled/facebook-www/ReactDOM-dev.modern.js @@ -28437,6 +28437,7 @@ var didScheduleMicrotask_act = false; // Used to quickly bail out of flushSync i var mightHavePendingSyncWork = false; var isFlushingWork = false; +var currentEventTransitionLane = NoLanes; function ensureRootIsScheduled(root) { // This function is called whenever a root receives an update. It does two // things 1) it ensures the root is in the root schedule, and 2) it ensures @@ -28595,6 +28596,14 @@ function processRootScheduleInMicrotask() { while (root !== null) { var next = root.next; + + if ( + currentEventTransitionLane !== NoLane && + shouldAttemptEagerTransition() + ) { + markRootEntangled(root, mergeLanes(currentEventTransitionLane, SyncLane)); + } + var nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); if (nextLanes === NoLane) { @@ -28626,7 +28635,9 @@ function processRootScheduleInMicrotask() { } root = next; - } // At the end of the microtask, flush any pending synchronous work. This has + } + + currentEventTransitionLane = NoLane; // At the end of the microtask, flush any pending synchronous work. This has // to come at the end, because it does actual rendering work that might throw. flushSyncWorkOnAllRoots(); @@ -28817,6 +28828,13 @@ function scheduleImmediateTask(cb) { } } +function getCurrentEventTransitionLane() { + return currentEventTransitionLane; +} +function setCurrentEventTransitionLane(lane) { + currentEventTransitionLane = lane; +} + var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map; var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, @@ -29082,7 +29100,6 @@ var didScheduleUpdateDuringPassiveEffects = false; var NESTED_PASSIVE_UPDATE_LIMIT = 50; var nestedPassiveUpdateCount = 0; var rootWithPassiveNestedUpdates = null; -var currentEventTransitionLane = NoLanes; var isRunningInsertionEffect = false; function getWorkInProgressRoot() { return workInProgressRoot; @@ -29134,12 +29151,12 @@ function requestUpdateLane(fiber) { // event. Then reset the cached values once we can be sure the event is // over. Our heuristic for that is whenever we enter a concurrent work loop. - if (currentEventTransitionLane === NoLane) { + if (getCurrentEventTransitionLane() === NoLane) { // All transitions within the same event are assigned the same lane. - currentEventTransitionLane = claimNextTransitionLane(); + setCurrentEventTransitionLane(claimNextTransitionLane()); } - return currentEventTransitionLane; + return getCurrentEventTransitionLane(); } // Updates originating inside certain React methods, like flushSync, have // their priority set by tracking it with a context variable. // @@ -29331,8 +29348,6 @@ function performConcurrentWorkOnRoot(root, didTimeout) { resetNestedUpdateFlag(); } - currentEventTransitionLane = NoLanes; - if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { throw new Error("Should not already be working."); } // Flush any pending passive effects before deciding which lanes to work on, @@ -33558,7 +33573,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-f611b8f0"; +var ReactVersion = "18.3.0-www-modern-342727fc"; function createPortal$1( children, @@ -42486,6 +42501,9 @@ function getCurrentEventPriority() { return getEventPriority(currentEvent.type); } +function shouldAttemptEagerTransition() { + return window.event && window.event.type === "popstate"; +} // if a component just imports ReactDOM (e.g. for findDOMNode). // Some environments might not have setTimeout or clearTimeout. diff --git a/compiled/facebook-www/ReactDOM-prod.classic.js b/compiled/facebook-www/ReactDOM-prod.classic.js index ba40df3919..08a79200fb 100644 --- a/compiled/facebook-www/ReactDOM-prod.classic.js +++ b/compiled/facebook-www/ReactDOM-prod.classic.js @@ -9346,7 +9346,8 @@ var firstScheduledRoot = null, lastScheduledRoot = null, didScheduleMicrotask = !1, mightHavePendingSyncWork = !1, - isFlushingWork = !1; + isFlushingWork = !1, + currentEventTransitionLane = 0; function ensureRootIsScheduled(root) { root !== lastScheduledRoot && null === root.next && @@ -9450,8 +9451,12 @@ function processRootScheduleInMicrotask() { null !== root; ) { - var next = root.next, - nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); + var next = root.next; + 0 !== currentEventTransitionLane && + window.event && + "popstate" === window.event.type && + markRootEntangled(root, currentEventTransitionLane | 2); + var nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); 0 === nextLanes ? ((root.next = null), null === prev ? (firstScheduledRoot = next) : (prev.next = next), @@ -9460,6 +9465,7 @@ function processRootScheduleInMicrotask() { 0 !== (nextLanes & 3) && (mightHavePendingSyncWork = !0)); root = next; } + currentEventTransitionLane = 0; flushSyncWorkAcrossRoots_impl(!1); } function scheduleTaskForRootDuringMicrotask(root, currentTime) { @@ -9635,8 +9641,7 @@ var hasUncaughtError = !1, pendingPassiveEffectsRemainingLanes = 0, pendingPassiveTransitions = null, nestedUpdateCount = 0, - rootWithNestedUpdates = null, - currentEventTransitionLane = 0; + rootWithNestedUpdates = null; function requestUpdateLane(fiber) { if (0 === (fiber.mode & 1)) return 2; if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) @@ -9692,7 +9697,6 @@ function scheduleUpdateOnFiber(root, fiber, lane) { } } function performConcurrentWorkOnRoot(root, didTimeout) { - currentEventTransitionLane = 0; if (0 !== (executionContext & 6)) throw Error(formatProdErrorMessage(327)); var originalCallbackNode = root.callbackNode; if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) @@ -12516,14 +12520,14 @@ var isInputEventSupported = !1; if (canUseDOM) { var JSCompiler_inline_result$jscomp$379; if (canUseDOM) { - var isSupported$jscomp$inline_1612 = "oninput" in document; - if (!isSupported$jscomp$inline_1612) { - var element$jscomp$inline_1613 = document.createElement("div"); - element$jscomp$inline_1613.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1612 = - "function" === typeof element$jscomp$inline_1613.oninput; + var isSupported$jscomp$inline_1614 = "oninput" in document; + if (!isSupported$jscomp$inline_1614) { + var element$jscomp$inline_1615 = document.createElement("div"); + element$jscomp$inline_1615.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1614 = + "function" === typeof element$jscomp$inline_1615.oninput; } - JSCompiler_inline_result$jscomp$379 = isSupported$jscomp$inline_1612; + JSCompiler_inline_result$jscomp$379 = isSupported$jscomp$inline_1614; } else JSCompiler_inline_result$jscomp$379 = !1; isInputEventSupported = JSCompiler_inline_result$jscomp$379 && @@ -12835,20 +12839,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1653 = 0; - i$jscomp$inline_1653 < simpleEventPluginEvents.length; - i$jscomp$inline_1653++ + var i$jscomp$inline_1655 = 0; + i$jscomp$inline_1655 < simpleEventPluginEvents.length; + i$jscomp$inline_1655++ ) { - var eventName$jscomp$inline_1654 = - simpleEventPluginEvents[i$jscomp$inline_1653], - domEventName$jscomp$inline_1655 = - eventName$jscomp$inline_1654.toLowerCase(), - capitalizedEvent$jscomp$inline_1656 = - eventName$jscomp$inline_1654[0].toUpperCase() + - eventName$jscomp$inline_1654.slice(1); + var eventName$jscomp$inline_1656 = + simpleEventPluginEvents[i$jscomp$inline_1655], + domEventName$jscomp$inline_1657 = + eventName$jscomp$inline_1656.toLowerCase(), + capitalizedEvent$jscomp$inline_1658 = + eventName$jscomp$inline_1656[0].toUpperCase() + + eventName$jscomp$inline_1656.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1655, - "on" + capitalizedEvent$jscomp$inline_1656 + domEventName$jscomp$inline_1657, + "on" + capitalizedEvent$jscomp$inline_1658 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -16385,17 +16389,17 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1854 = { +var devToolsConfig$jscomp$inline_1856 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-2c38c926", + version: "18.3.0-www-classic-865dfeb0", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2220 = { - bundleType: devToolsConfig$jscomp$inline_1854.bundleType, - version: devToolsConfig$jscomp$inline_1854.version, - rendererPackageName: devToolsConfig$jscomp$inline_1854.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1854.rendererConfig, +var internals$jscomp$inline_2222 = { + bundleType: devToolsConfig$jscomp$inline_1856.bundleType, + version: devToolsConfig$jscomp$inline_1856.version, + rendererPackageName: devToolsConfig$jscomp$inline_1856.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1856.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -16411,26 +16415,26 @@ var internals$jscomp$inline_2220 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1854.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1856.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-2c38c926" + reconcilerVersion: "18.3.0-www-classic-865dfeb0" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2221 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2223 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2221.isDisabled && - hook$jscomp$inline_2221.supportsFiber + !hook$jscomp$inline_2223.isDisabled && + hook$jscomp$inline_2223.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2221.inject( - internals$jscomp$inline_2220 + (rendererID = hook$jscomp$inline_2223.inject( + internals$jscomp$inline_2222 )), - (injectedHook = hook$jscomp$inline_2221); + (injectedHook = hook$jscomp$inline_2223); } catch (err) {} } assign(Internals, { @@ -16658,4 +16662,4 @@ exports.unstable_renderSubtreeIntoContainer = function ( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-www-classic-2c38c926"; +exports.version = "18.3.0-www-classic-865dfeb0"; diff --git a/compiled/facebook-www/ReactDOM-prod.modern.js b/compiled/facebook-www/ReactDOM-prod.modern.js index 7bbbffc368..81aa762c04 100644 --- a/compiled/facebook-www/ReactDOM-prod.modern.js +++ b/compiled/facebook-www/ReactDOM-prod.modern.js @@ -9177,7 +9177,8 @@ var firstScheduledRoot = null, lastScheduledRoot = null, didScheduleMicrotask = !1, mightHavePendingSyncWork = !1, - isFlushingWork = !1; + isFlushingWork = !1, + currentEventTransitionLane = 0; function ensureRootIsScheduled(root) { root !== lastScheduledRoot && null === root.next && @@ -9281,8 +9282,12 @@ function processRootScheduleInMicrotask() { null !== root; ) { - var next = root.next, - nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); + var next = root.next; + 0 !== currentEventTransitionLane && + window.event && + "popstate" === window.event.type && + markRootEntangled(root, currentEventTransitionLane | 2); + var nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); 0 === nextLanes ? ((root.next = null), null === prev ? (firstScheduledRoot = next) : (prev.next = next), @@ -9291,6 +9296,7 @@ function processRootScheduleInMicrotask() { 0 !== (nextLanes & 3) && (mightHavePendingSyncWork = !0)); root = next; } + currentEventTransitionLane = 0; flushSyncWorkAcrossRoots_impl(!1); } function scheduleTaskForRootDuringMicrotask(root, currentTime) { @@ -9466,8 +9472,7 @@ var hasUncaughtError = !1, pendingPassiveEffectsRemainingLanes = 0, pendingPassiveTransitions = null, nestedUpdateCount = 0, - rootWithNestedUpdates = null, - currentEventTransitionLane = 0; + rootWithNestedUpdates = null; function requestUpdateLane(fiber) { if (0 === (fiber.mode & 1)) return 2; if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) @@ -9523,7 +9528,6 @@ function scheduleUpdateOnFiber(root, fiber, lane) { } } function performConcurrentWorkOnRoot(root, didTimeout) { - currentEventTransitionLane = 0; if (0 !== (executionContext & 6)) throw Error(formatProdErrorMessage(327)); var originalCallbackNode = root.callbackNode; if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) @@ -12748,14 +12752,14 @@ var isInputEventSupported = !1; if (canUseDOM) { var JSCompiler_inline_result$jscomp$376; if (canUseDOM) { - var isSupported$jscomp$inline_1604 = "oninput" in document; - if (!isSupported$jscomp$inline_1604) { - var element$jscomp$inline_1605 = document.createElement("div"); - element$jscomp$inline_1605.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1604 = - "function" === typeof element$jscomp$inline_1605.oninput; + var isSupported$jscomp$inline_1606 = "oninput" in document; + if (!isSupported$jscomp$inline_1606) { + var element$jscomp$inline_1607 = document.createElement("div"); + element$jscomp$inline_1607.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1606 = + "function" === typeof element$jscomp$inline_1607.oninput; } - JSCompiler_inline_result$jscomp$376 = isSupported$jscomp$inline_1604; + JSCompiler_inline_result$jscomp$376 = isSupported$jscomp$inline_1606; } else JSCompiler_inline_result$jscomp$376 = !1; isInputEventSupported = JSCompiler_inline_result$jscomp$376 && @@ -13067,20 +13071,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1645 = 0; - i$jscomp$inline_1645 < simpleEventPluginEvents.length; - i$jscomp$inline_1645++ + var i$jscomp$inline_1647 = 0; + i$jscomp$inline_1647 < simpleEventPluginEvents.length; + i$jscomp$inline_1647++ ) { - var eventName$jscomp$inline_1646 = - simpleEventPluginEvents[i$jscomp$inline_1645], - domEventName$jscomp$inline_1647 = - eventName$jscomp$inline_1646.toLowerCase(), - capitalizedEvent$jscomp$inline_1648 = - eventName$jscomp$inline_1646[0].toUpperCase() + - eventName$jscomp$inline_1646.slice(1); + var eventName$jscomp$inline_1648 = + simpleEventPluginEvents[i$jscomp$inline_1647], + domEventName$jscomp$inline_1649 = + eventName$jscomp$inline_1648.toLowerCase(), + capitalizedEvent$jscomp$inline_1650 = + eventName$jscomp$inline_1648[0].toUpperCase() + + eventName$jscomp$inline_1648.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1647, - "on" + capitalizedEvent$jscomp$inline_1648 + domEventName$jscomp$inline_1649, + "on" + capitalizedEvent$jscomp$inline_1650 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -15912,17 +15916,17 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1813 = { +var devToolsConfig$jscomp$inline_1815 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-17292089", + version: "18.3.0-www-modern-1d8e3f88", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2184 = { - bundleType: devToolsConfig$jscomp$inline_1813.bundleType, - version: devToolsConfig$jscomp$inline_1813.version, - rendererPackageName: devToolsConfig$jscomp$inline_1813.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1813.rendererConfig, +var internals$jscomp$inline_2186 = { + bundleType: devToolsConfig$jscomp$inline_1815.bundleType, + version: devToolsConfig$jscomp$inline_1815.version, + rendererPackageName: devToolsConfig$jscomp$inline_1815.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1815.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -15939,26 +15943,26 @@ var internals$jscomp$inline_2184 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1813.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1815.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-17292089" + reconcilerVersion: "18.3.0-www-modern-1d8e3f88" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2185 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2187 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2185.isDisabled && - hook$jscomp$inline_2185.supportsFiber + !hook$jscomp$inline_2187.isDisabled && + hook$jscomp$inline_2187.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2185.inject( - internals$jscomp$inline_2184 + (rendererID = hook$jscomp$inline_2187.inject( + internals$jscomp$inline_2186 )), - (injectedHook = hook$jscomp$inline_2185); + (injectedHook = hook$jscomp$inline_2187); } catch (err) {} } exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; @@ -16114,4 +16118,4 @@ exports.unstable_createEventHandle = function (type, options) { return eventHandle; }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-www-modern-17292089"; +exports.version = "18.3.0-www-modern-1d8e3f88"; diff --git a/compiled/facebook-www/ReactDOM-profiling.classic.js b/compiled/facebook-www/ReactDOM-profiling.classic.js index b26e63fe0b..ddf9da5cda 100644 --- a/compiled/facebook-www/ReactDOM-profiling.classic.js +++ b/compiled/facebook-www/ReactDOM-profiling.classic.js @@ -9934,7 +9934,8 @@ var firstScheduledRoot = null, lastScheduledRoot = null, didScheduleMicrotask = !1, mightHavePendingSyncWork = !1, - isFlushingWork = !1; + isFlushingWork = !1, + currentEventTransitionLane = 0; function ensureRootIsScheduled(root) { root !== lastScheduledRoot && null === root.next && @@ -10040,8 +10041,12 @@ function processRootScheduleInMicrotask() { null !== root; ) { - var next = root.next, - nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); + var next = root.next; + 0 !== currentEventTransitionLane && + window.event && + "popstate" === window.event.type && + markRootEntangled(root, currentEventTransitionLane | 2); + var nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); 0 === nextLanes ? ((root.next = null), null === prev ? (firstScheduledRoot = next) : (prev.next = next), @@ -10050,6 +10055,7 @@ function processRootScheduleInMicrotask() { 0 !== (nextLanes & 3) && (mightHavePendingSyncWork = !0)); root = next; } + currentEventTransitionLane = 0; flushSyncWorkAcrossRoots_impl(!1); } function scheduleTaskForRootDuringMicrotask(root, currentTime) { @@ -10227,8 +10233,7 @@ var hasUncaughtError = !1, pendingPassiveEffectsRemainingLanes = 0, pendingPassiveTransitions = null, nestedUpdateCount = 0, - rootWithNestedUpdates = null, - currentEventTransitionLane = 0; + rootWithNestedUpdates = null; function requestUpdateLane(fiber) { if (0 === (fiber.mode & 1)) return 2; if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) @@ -10301,7 +10306,6 @@ function scheduleUpdateOnFiber(root, fiber, lane) { } function performConcurrentWorkOnRoot(root, didTimeout) { nestedUpdateScheduled = currentUpdateIsNested = !1; - currentEventTransitionLane = 0; if (0 !== (executionContext & 6)) throw Error(formatProdErrorMessage(327)); var originalCallbackNode = root.callbackNode; if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) @@ -13290,14 +13294,14 @@ var isInputEventSupported = !1; if (canUseDOM) { var JSCompiler_inline_result$jscomp$400; if (canUseDOM) { - var isSupported$jscomp$inline_1693 = "oninput" in document; - if (!isSupported$jscomp$inline_1693) { - var element$jscomp$inline_1694 = document.createElement("div"); - element$jscomp$inline_1694.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1693 = - "function" === typeof element$jscomp$inline_1694.oninput; + var isSupported$jscomp$inline_1695 = "oninput" in document; + if (!isSupported$jscomp$inline_1695) { + var element$jscomp$inline_1696 = document.createElement("div"); + element$jscomp$inline_1696.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1695 = + "function" === typeof element$jscomp$inline_1696.oninput; } - JSCompiler_inline_result$jscomp$400 = isSupported$jscomp$inline_1693; + JSCompiler_inline_result$jscomp$400 = isSupported$jscomp$inline_1695; } else JSCompiler_inline_result$jscomp$400 = !1; isInputEventSupported = JSCompiler_inline_result$jscomp$400 && @@ -13609,20 +13613,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1734 = 0; - i$jscomp$inline_1734 < simpleEventPluginEvents.length; - i$jscomp$inline_1734++ + var i$jscomp$inline_1736 = 0; + i$jscomp$inline_1736 < simpleEventPluginEvents.length; + i$jscomp$inline_1736++ ) { - var eventName$jscomp$inline_1735 = - simpleEventPluginEvents[i$jscomp$inline_1734], - domEventName$jscomp$inline_1736 = - eventName$jscomp$inline_1735.toLowerCase(), - capitalizedEvent$jscomp$inline_1737 = - eventName$jscomp$inline_1735[0].toUpperCase() + - eventName$jscomp$inline_1735.slice(1); + var eventName$jscomp$inline_1737 = + simpleEventPluginEvents[i$jscomp$inline_1736], + domEventName$jscomp$inline_1738 = + eventName$jscomp$inline_1737.toLowerCase(), + capitalizedEvent$jscomp$inline_1739 = + eventName$jscomp$inline_1737[0].toUpperCase() + + eventName$jscomp$inline_1737.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1736, - "on" + capitalizedEvent$jscomp$inline_1737 + domEventName$jscomp$inline_1738, + "on" + capitalizedEvent$jscomp$inline_1739 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -17159,10 +17163,10 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1935 = { +var devToolsConfig$jscomp$inline_1937 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-601ad9b2", + version: "18.3.0-www-classic-ceea03b0", rendererPackageName: "react-dom" }; (function (internals) { @@ -17180,10 +17184,10 @@ var devToolsConfig$jscomp$inline_1935 = { } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1935.bundleType, - version: devToolsConfig$jscomp$inline_1935.version, - rendererPackageName: devToolsConfig$jscomp$inline_1935.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1935.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1937.bundleType, + version: devToolsConfig$jscomp$inline_1937.version, + rendererPackageName: devToolsConfig$jscomp$inline_1937.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1937.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -17199,14 +17203,14 @@ var devToolsConfig$jscomp$inline_1935 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1935.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1937.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-601ad9b2" + reconcilerVersion: "18.3.0-www-classic-ceea03b0" }); assign(Internals, { ReactBrowserEventEmitter: { @@ -17433,7 +17437,7 @@ exports.unstable_renderSubtreeIntoContainer = function ( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-www-classic-601ad9b2"; +exports.version = "18.3.0-www-classic-ceea03b0"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactDOM-profiling.modern.js b/compiled/facebook-www/ReactDOM-profiling.modern.js index b806085fad..99c9641ed4 100644 --- a/compiled/facebook-www/ReactDOM-profiling.modern.js +++ b/compiled/facebook-www/ReactDOM-profiling.modern.js @@ -9759,7 +9759,8 @@ var firstScheduledRoot = null, lastScheduledRoot = null, didScheduleMicrotask = !1, mightHavePendingSyncWork = !1, - isFlushingWork = !1; + isFlushingWork = !1, + currentEventTransitionLane = 0; function ensureRootIsScheduled(root) { root !== lastScheduledRoot && null === root.next && @@ -9865,8 +9866,12 @@ function processRootScheduleInMicrotask() { null !== root; ) { - var next = root.next, - nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); + var next = root.next; + 0 !== currentEventTransitionLane && + window.event && + "popstate" === window.event.type && + markRootEntangled(root, currentEventTransitionLane | 2); + var nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); 0 === nextLanes ? ((root.next = null), null === prev ? (firstScheduledRoot = next) : (prev.next = next), @@ -9875,6 +9880,7 @@ function processRootScheduleInMicrotask() { 0 !== (nextLanes & 3) && (mightHavePendingSyncWork = !0)); root = next; } + currentEventTransitionLane = 0; flushSyncWorkAcrossRoots_impl(!1); } function scheduleTaskForRootDuringMicrotask(root, currentTime) { @@ -10052,8 +10058,7 @@ var hasUncaughtError = !1, pendingPassiveEffectsRemainingLanes = 0, pendingPassiveTransitions = null, nestedUpdateCount = 0, - rootWithNestedUpdates = null, - currentEventTransitionLane = 0; + rootWithNestedUpdates = null; function requestUpdateLane(fiber) { if (0 === (fiber.mode & 1)) return 2; if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) @@ -10126,7 +10131,6 @@ function scheduleUpdateOnFiber(root, fiber, lane) { } function performConcurrentWorkOnRoot(root, didTimeout) { nestedUpdateScheduled = currentUpdateIsNested = !1; - currentEventTransitionLane = 0; if (0 !== (executionContext & 6)) throw Error(formatProdErrorMessage(327)); var originalCallbackNode = root.callbackNode; if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) @@ -13516,14 +13520,14 @@ var isInputEventSupported = !1; if (canUseDOM) { var JSCompiler_inline_result$jscomp$397; if (canUseDOM) { - var isSupported$jscomp$inline_1685 = "oninput" in document; - if (!isSupported$jscomp$inline_1685) { - var element$jscomp$inline_1686 = document.createElement("div"); - element$jscomp$inline_1686.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1685 = - "function" === typeof element$jscomp$inline_1686.oninput; + var isSupported$jscomp$inline_1687 = "oninput" in document; + if (!isSupported$jscomp$inline_1687) { + var element$jscomp$inline_1688 = document.createElement("div"); + element$jscomp$inline_1688.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1687 = + "function" === typeof element$jscomp$inline_1688.oninput; } - JSCompiler_inline_result$jscomp$397 = isSupported$jscomp$inline_1685; + JSCompiler_inline_result$jscomp$397 = isSupported$jscomp$inline_1687; } else JSCompiler_inline_result$jscomp$397 = !1; isInputEventSupported = JSCompiler_inline_result$jscomp$397 && @@ -13835,20 +13839,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1726 = 0; - i$jscomp$inline_1726 < simpleEventPluginEvents.length; - i$jscomp$inline_1726++ + var i$jscomp$inline_1728 = 0; + i$jscomp$inline_1728 < simpleEventPluginEvents.length; + i$jscomp$inline_1728++ ) { - var eventName$jscomp$inline_1727 = - simpleEventPluginEvents[i$jscomp$inline_1726], - domEventName$jscomp$inline_1728 = - eventName$jscomp$inline_1727.toLowerCase(), - capitalizedEvent$jscomp$inline_1729 = - eventName$jscomp$inline_1727[0].toUpperCase() + - eventName$jscomp$inline_1727.slice(1); + var eventName$jscomp$inline_1729 = + simpleEventPluginEvents[i$jscomp$inline_1728], + domEventName$jscomp$inline_1730 = + eventName$jscomp$inline_1729.toLowerCase(), + capitalizedEvent$jscomp$inline_1731 = + eventName$jscomp$inline_1729[0].toUpperCase() + + eventName$jscomp$inline_1729.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1728, - "on" + capitalizedEvent$jscomp$inline_1729 + domEventName$jscomp$inline_1730, + "on" + capitalizedEvent$jscomp$inline_1731 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -16680,10 +16684,10 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1894 = { +var devToolsConfig$jscomp$inline_1896 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-a3efb320", + version: "18.3.0-www-modern-0c712c4b", rendererPackageName: "react-dom" }; (function (internals) { @@ -16701,10 +16705,10 @@ var devToolsConfig$jscomp$inline_1894 = { } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1894.bundleType, - version: devToolsConfig$jscomp$inline_1894.version, - rendererPackageName: devToolsConfig$jscomp$inline_1894.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1894.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1896.bundleType, + version: devToolsConfig$jscomp$inline_1896.version, + rendererPackageName: devToolsConfig$jscomp$inline_1896.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1896.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -16721,14 +16725,14 @@ var devToolsConfig$jscomp$inline_1894 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1894.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1896.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-a3efb320" + reconcilerVersion: "18.3.0-www-modern-0c712c4b" }); exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; exports.createPortal = function (children, container) { @@ -16883,7 +16887,7 @@ exports.unstable_createEventHandle = function (type, options) { return eventHandle; }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-www-modern-a3efb320"; +exports.version = "18.3.0-www-modern-0c712c4b"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactDOMTesting-dev.classic.js b/compiled/facebook-www/ReactDOMTesting-dev.classic.js index d7493d251d..90c54dafcf 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.classic.js @@ -32535,6 +32535,7 @@ var didScheduleMicrotask_act = false; // Used to quickly bail out of flushSync i var mightHavePendingSyncWork = false; var isFlushingWork = false; +var currentEventTransitionLane = NoLanes; function ensureRootIsScheduled(root) { // This function is called whenever a root receives an update. It does two // things 1) it ensures the root is in the root schedule, and 2) it ensures @@ -32693,6 +32694,14 @@ function processRootScheduleInMicrotask() { while (root !== null) { var next = root.next; + + if ( + currentEventTransitionLane !== NoLane && + shouldAttemptEagerTransition() + ) { + markRootEntangled(root, mergeLanes(currentEventTransitionLane, SyncLane)); + } + var nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); if (nextLanes === NoLane) { @@ -32724,7 +32733,9 @@ function processRootScheduleInMicrotask() { } root = next; - } // At the end of the microtask, flush any pending synchronous work. This has + } + + currentEventTransitionLane = NoLane; // At the end of the microtask, flush any pending synchronous work. This has // to come at the end, because it does actual rendering work that might throw. flushSyncWorkOnAllRoots(); @@ -32915,6 +32926,13 @@ function scheduleImmediateTask(cb) { } } +function getCurrentEventTransitionLane() { + return currentEventTransitionLane; +} +function setCurrentEventTransitionLane(lane) { + currentEventTransitionLane = lane; +} + var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map; var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, @@ -33180,7 +33198,6 @@ var didScheduleUpdateDuringPassiveEffects = false; var NESTED_PASSIVE_UPDATE_LIMIT = 50; var nestedPassiveUpdateCount = 0; var rootWithPassiveNestedUpdates = null; -var currentEventTransitionLane = NoLanes; var isRunningInsertionEffect = false; function getWorkInProgressRoot() { return workInProgressRoot; @@ -33232,12 +33249,12 @@ function requestUpdateLane(fiber) { // event. Then reset the cached values once we can be sure the event is // over. Our heuristic for that is whenever we enter a concurrent work loop. - if (currentEventTransitionLane === NoLane) { + if (getCurrentEventTransitionLane() === NoLane) { // All transitions within the same event are assigned the same lane. - currentEventTransitionLane = claimNextTransitionLane(); + setCurrentEventTransitionLane(claimNextTransitionLane()); } - return currentEventTransitionLane; + return getCurrentEventTransitionLane(); } // Updates originating inside certain React methods, like flushSync, have // their priority set by tracking it with a context variable. // @@ -33429,8 +33446,6 @@ function performConcurrentWorkOnRoot(root, didTimeout) { resetNestedUpdateFlag(); } - currentEventTransitionLane = NoLanes; - if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { throw new Error("Should not already be working."); } // Flush any pending passive effects before deciding which lanes to work on, @@ -37661,7 +37676,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-3380b4f4"; +var ReactVersion = "18.3.0-www-classic-50cde584"; function createPortal$1( children, @@ -43565,6 +43580,9 @@ function getCurrentEventPriority() { return getEventPriority(currentEvent.type); } +function shouldAttemptEagerTransition() { + return window.event && window.event.type === "popstate"; +} // if a component just imports ReactDOM (e.g. for findDOMNode). // Some environments might not have setTimeout or clearTimeout. diff --git a/compiled/facebook-www/ReactDOMTesting-dev.modern.js b/compiled/facebook-www/ReactDOMTesting-dev.modern.js index 101d9114ea..5fa3111e30 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.modern.js @@ -29056,6 +29056,7 @@ var didScheduleMicrotask_act = false; // Used to quickly bail out of flushSync i var mightHavePendingSyncWork = false; var isFlushingWork = false; +var currentEventTransitionLane = NoLanes; function ensureRootIsScheduled(root) { // This function is called whenever a root receives an update. It does two // things 1) it ensures the root is in the root schedule, and 2) it ensures @@ -29214,6 +29215,14 @@ function processRootScheduleInMicrotask() { while (root !== null) { var next = root.next; + + if ( + currentEventTransitionLane !== NoLane && + shouldAttemptEagerTransition() + ) { + markRootEntangled(root, mergeLanes(currentEventTransitionLane, SyncLane)); + } + var nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); if (nextLanes === NoLane) { @@ -29245,7 +29254,9 @@ function processRootScheduleInMicrotask() { } root = next; - } // At the end of the microtask, flush any pending synchronous work. This has + } + + currentEventTransitionLane = NoLane; // At the end of the microtask, flush any pending synchronous work. This has // to come at the end, because it does actual rendering work that might throw. flushSyncWorkOnAllRoots(); @@ -29436,6 +29447,13 @@ function scheduleImmediateTask(cb) { } } +function getCurrentEventTransitionLane() { + return currentEventTransitionLane; +} +function setCurrentEventTransitionLane(lane) { + currentEventTransitionLane = lane; +} + var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map; var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, @@ -29701,7 +29719,6 @@ var didScheduleUpdateDuringPassiveEffects = false; var NESTED_PASSIVE_UPDATE_LIMIT = 50; var nestedPassiveUpdateCount = 0; var rootWithPassiveNestedUpdates = null; -var currentEventTransitionLane = NoLanes; var isRunningInsertionEffect = false; function getWorkInProgressRoot() { return workInProgressRoot; @@ -29753,12 +29770,12 @@ function requestUpdateLane(fiber) { // event. Then reset the cached values once we can be sure the event is // over. Our heuristic for that is whenever we enter a concurrent work loop. - if (currentEventTransitionLane === NoLane) { + if (getCurrentEventTransitionLane() === NoLane) { // All transitions within the same event are assigned the same lane. - currentEventTransitionLane = claimNextTransitionLane(); + setCurrentEventTransitionLane(claimNextTransitionLane()); } - return currentEventTransitionLane; + return getCurrentEventTransitionLane(); } // Updates originating inside certain React methods, like flushSync, have // their priority set by tracking it with a context variable. // @@ -29950,8 +29967,6 @@ function performConcurrentWorkOnRoot(root, didTimeout) { resetNestedUpdateFlag(); } - currentEventTransitionLane = NoLanes; - if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { throw new Error("Should not already be working."); } // Flush any pending passive effects before deciding which lanes to work on, @@ -34177,7 +34192,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-0eebbf55"; +var ReactVersion = "18.3.0-www-modern-cc5ab9ca"; function createPortal$1( children, @@ -43105,6 +43120,9 @@ function getCurrentEventPriority() { return getEventPriority(currentEvent.type); } +function shouldAttemptEagerTransition() { + return window.event && window.event.type === "popstate"; +} // if a component just imports ReactDOM (e.g. for findDOMNode). // Some environments might not have setTimeout or clearTimeout. diff --git a/compiled/facebook-www/ReactDOMTesting-prod.classic.js b/compiled/facebook-www/ReactDOMTesting-prod.classic.js index c5fa6900f6..e384d26196 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.classic.js @@ -10576,7 +10576,8 @@ var firstScheduledRoot = null, lastScheduledRoot = null, didScheduleMicrotask = !1, mightHavePendingSyncWork = !1, - isFlushingWork = !1; + isFlushingWork = !1, + currentEventTransitionLane = 0; function ensureRootIsScheduled(root) { root !== lastScheduledRoot && null === root.next && @@ -10680,8 +10681,12 @@ function processRootScheduleInMicrotask() { null !== root; ) { - var next = root.next, - nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); + var next = root.next; + 0 !== currentEventTransitionLane && + window.event && + "popstate" === window.event.type && + markRootEntangled(root, currentEventTransitionLane | 2); + var nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); 0 === nextLanes ? ((root.next = null), null === prev ? (firstScheduledRoot = next) : (prev.next = next), @@ -10690,6 +10695,7 @@ function processRootScheduleInMicrotask() { 0 !== (nextLanes & 3) && (mightHavePendingSyncWork = !0)); root = next; } + currentEventTransitionLane = 0; flushSyncWorkAcrossRoots_impl(!1); } function scheduleTaskForRootDuringMicrotask(root, currentTime) { @@ -10865,8 +10871,7 @@ var hasUncaughtError = !1, pendingPassiveEffectsRemainingLanes = 0, pendingPassiveTransitions = null, nestedUpdateCount = 0, - rootWithNestedUpdates = null, - currentEventTransitionLane = 0; + rootWithNestedUpdates = null; function requestUpdateLane(fiber) { if (0 === (fiber.mode & 1)) return 2; if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) @@ -10922,7 +10927,6 @@ function scheduleUpdateOnFiber(root, fiber, lane) { } } function performConcurrentWorkOnRoot(root, didTimeout) { - currentEventTransitionLane = 0; if (0 !== (executionContext & 6)) throw Error(formatProdErrorMessage(327)); var originalCallbackNode = root.callbackNode; if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) @@ -13746,14 +13750,14 @@ var isInputEventSupported = !1; if (canUseDOM) { var JSCompiler_inline_result$jscomp$382; if (canUseDOM) { - var isSupported$jscomp$inline_1657 = "oninput" in document; - if (!isSupported$jscomp$inline_1657) { - var element$jscomp$inline_1658 = document.createElement("div"); - element$jscomp$inline_1658.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1657 = - "function" === typeof element$jscomp$inline_1658.oninput; + var isSupported$jscomp$inline_1659 = "oninput" in document; + if (!isSupported$jscomp$inline_1659) { + var element$jscomp$inline_1660 = document.createElement("div"); + element$jscomp$inline_1660.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1659 = + "function" === typeof element$jscomp$inline_1660.oninput; } - JSCompiler_inline_result$jscomp$382 = isSupported$jscomp$inline_1657; + JSCompiler_inline_result$jscomp$382 = isSupported$jscomp$inline_1659; } else JSCompiler_inline_result$jscomp$382 = !1; isInputEventSupported = JSCompiler_inline_result$jscomp$382 && @@ -14065,20 +14069,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1698 = 0; - i$jscomp$inline_1698 < simpleEventPluginEvents.length; - i$jscomp$inline_1698++ + var i$jscomp$inline_1700 = 0; + i$jscomp$inline_1700 < simpleEventPluginEvents.length; + i$jscomp$inline_1700++ ) { - var eventName$jscomp$inline_1699 = - simpleEventPluginEvents[i$jscomp$inline_1698], - domEventName$jscomp$inline_1700 = - eventName$jscomp$inline_1699.toLowerCase(), - capitalizedEvent$jscomp$inline_1701 = - eventName$jscomp$inline_1699[0].toUpperCase() + - eventName$jscomp$inline_1699.slice(1); + var eventName$jscomp$inline_1701 = + simpleEventPluginEvents[i$jscomp$inline_1700], + domEventName$jscomp$inline_1702 = + eventName$jscomp$inline_1701.toLowerCase(), + capitalizedEvent$jscomp$inline_1703 = + eventName$jscomp$inline_1701[0].toUpperCase() + + eventName$jscomp$inline_1701.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1700, - "on" + capitalizedEvent$jscomp$inline_1701 + domEventName$jscomp$inline_1702, + "on" + capitalizedEvent$jscomp$inline_1703 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -15091,17 +15095,17 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1812 = { +var devToolsConfig$jscomp$inline_1814 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-4e76503d", + version: "18.3.0-www-classic-09c9197a", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2250 = { - bundleType: devToolsConfig$jscomp$inline_1812.bundleType, - version: devToolsConfig$jscomp$inline_1812.version, - rendererPackageName: devToolsConfig$jscomp$inline_1812.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1812.rendererConfig, +var internals$jscomp$inline_2252 = { + bundleType: devToolsConfig$jscomp$inline_1814.bundleType, + version: devToolsConfig$jscomp$inline_1814.version, + rendererPackageName: devToolsConfig$jscomp$inline_1814.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1814.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -15117,26 +15121,26 @@ var internals$jscomp$inline_2250 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1812.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1814.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-4e76503d" + reconcilerVersion: "18.3.0-www-classic-09c9197a" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2251 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2253 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2251.isDisabled && - hook$jscomp$inline_2251.supportsFiber + !hook$jscomp$inline_2253.isDisabled && + hook$jscomp$inline_2253.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2251.inject( - internals$jscomp$inline_2250 + (rendererID = hook$jscomp$inline_2253.inject( + internals$jscomp$inline_2252 )), - (injectedHook = hook$jscomp$inline_2251); + (injectedHook = hook$jscomp$inline_2253); } catch (err) {} } var tagToRoleMappings = { @@ -17124,4 +17128,4 @@ exports.unstable_renderSubtreeIntoContainer = function ( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-www-classic-4e76503d"; +exports.version = "18.3.0-www-classic-09c9197a"; diff --git a/compiled/facebook-www/ReactDOMTesting-prod.modern.js b/compiled/facebook-www/ReactDOMTesting-prod.modern.js index fa40a8e6a2..8df7fc0e46 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.modern.js @@ -9504,7 +9504,8 @@ var firstScheduledRoot = null, lastScheduledRoot = null, didScheduleMicrotask = !1, mightHavePendingSyncWork = !1, - isFlushingWork = !1; + isFlushingWork = !1, + currentEventTransitionLane = 0; function ensureRootIsScheduled(root) { root !== lastScheduledRoot && null === root.next && @@ -9608,8 +9609,12 @@ function processRootScheduleInMicrotask() { null !== root; ) { - var next = root.next, - nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); + var next = root.next; + 0 !== currentEventTransitionLane && + window.event && + "popstate" === window.event.type && + markRootEntangled(root, currentEventTransitionLane | 2); + var nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); 0 === nextLanes ? ((root.next = null), null === prev ? (firstScheduledRoot = next) : (prev.next = next), @@ -9618,6 +9623,7 @@ function processRootScheduleInMicrotask() { 0 !== (nextLanes & 3) && (mightHavePendingSyncWork = !0)); root = next; } + currentEventTransitionLane = 0; flushSyncWorkAcrossRoots_impl(!1); } function scheduleTaskForRootDuringMicrotask(root, currentTime) { @@ -9793,8 +9799,7 @@ var hasUncaughtError = !1, pendingPassiveEffectsRemainingLanes = 0, pendingPassiveTransitions = null, nestedUpdateCount = 0, - rootWithNestedUpdates = null, - currentEventTransitionLane = 0; + rootWithNestedUpdates = null; function requestUpdateLane(fiber) { if (0 === (fiber.mode & 1)) return 2; if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) @@ -9850,7 +9855,6 @@ function scheduleUpdateOnFiber(root, fiber, lane) { } } function performConcurrentWorkOnRoot(root, didTimeout) { - currentEventTransitionLane = 0; if (0 !== (executionContext & 6)) throw Error(formatProdErrorMessage(327)); var originalCallbackNode = root.callbackNode; if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) @@ -13075,14 +13079,14 @@ var isInputEventSupported = !1; if (canUseDOM) { var JSCompiler_inline_result$jscomp$378; if (canUseDOM) { - var isSupported$jscomp$inline_1633 = "oninput" in document; - if (!isSupported$jscomp$inline_1633) { - var element$jscomp$inline_1634 = document.createElement("div"); - element$jscomp$inline_1634.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1633 = - "function" === typeof element$jscomp$inline_1634.oninput; + var isSupported$jscomp$inline_1635 = "oninput" in document; + if (!isSupported$jscomp$inline_1635) { + var element$jscomp$inline_1636 = document.createElement("div"); + element$jscomp$inline_1636.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1635 = + "function" === typeof element$jscomp$inline_1636.oninput; } - JSCompiler_inline_result$jscomp$378 = isSupported$jscomp$inline_1633; + JSCompiler_inline_result$jscomp$378 = isSupported$jscomp$inline_1635; } else JSCompiler_inline_result$jscomp$378 = !1; isInputEventSupported = JSCompiler_inline_result$jscomp$378 && @@ -13394,20 +13398,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1674 = 0; - i$jscomp$inline_1674 < simpleEventPluginEvents.length; - i$jscomp$inline_1674++ + var i$jscomp$inline_1676 = 0; + i$jscomp$inline_1676 < simpleEventPluginEvents.length; + i$jscomp$inline_1676++ ) { - var eventName$jscomp$inline_1675 = - simpleEventPluginEvents[i$jscomp$inline_1674], - domEventName$jscomp$inline_1676 = - eventName$jscomp$inline_1675.toLowerCase(), - capitalizedEvent$jscomp$inline_1677 = - eventName$jscomp$inline_1675[0].toUpperCase() + - eventName$jscomp$inline_1675.slice(1); + var eventName$jscomp$inline_1677 = + simpleEventPluginEvents[i$jscomp$inline_1676], + domEventName$jscomp$inline_1678 = + eventName$jscomp$inline_1677.toLowerCase(), + capitalizedEvent$jscomp$inline_1679 = + eventName$jscomp$inline_1677[0].toUpperCase() + + eventName$jscomp$inline_1677.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1676, - "on" + capitalizedEvent$jscomp$inline_1677 + domEventName$jscomp$inline_1678, + "on" + capitalizedEvent$jscomp$inline_1679 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -16296,17 +16300,17 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1842 = { +var devToolsConfig$jscomp$inline_1844 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-50a23993", + version: "18.3.0-www-modern-40ddfb33", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2218 = { - bundleType: devToolsConfig$jscomp$inline_1842.bundleType, - version: devToolsConfig$jscomp$inline_1842.version, - rendererPackageName: devToolsConfig$jscomp$inline_1842.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1842.rendererConfig, +var internals$jscomp$inline_2220 = { + bundleType: devToolsConfig$jscomp$inline_1844.bundleType, + version: devToolsConfig$jscomp$inline_1844.version, + rendererPackageName: devToolsConfig$jscomp$inline_1844.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1844.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -16323,26 +16327,26 @@ var internals$jscomp$inline_2218 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1842.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1844.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-50a23993" + reconcilerVersion: "18.3.0-www-modern-40ddfb33" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2219 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2221 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2219.isDisabled && - hook$jscomp$inline_2219.supportsFiber + !hook$jscomp$inline_2221.isDisabled && + hook$jscomp$inline_2221.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2219.inject( - internals$jscomp$inline_2218 + (rendererID = hook$jscomp$inline_2221.inject( + internals$jscomp$inline_2220 )), - (injectedHook = hook$jscomp$inline_2219); + (injectedHook = hook$jscomp$inline_2221); } catch (err) {} } exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; @@ -16649,4 +16653,4 @@ exports.unstable_createEventHandle = function (type, options) { return eventHandle; }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-www-modern-50a23993"; +exports.version = "18.3.0-www-modern-40ddfb33"; diff --git a/compiled/facebook-www/ReactTestRenderer-dev.classic.js b/compiled/facebook-www/ReactTestRenderer-dev.classic.js index 4e69708fd1..e6a29813ba 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.classic.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.classic.js @@ -2052,6 +2052,9 @@ function createTextInstance( function getCurrentEventPriority() { return DefaultEventPriority; } +function shouldAttemptEagerTransition() { + return false; +} var scheduleTimeout = setTimeout; var cancelTimeout = clearTimeout; var noTimeout = -1; // ------------------- @@ -19970,6 +19973,7 @@ var didScheduleMicrotask_act = false; // Used to quickly bail out of flushSync i var mightHavePendingSyncWork = false; var isFlushingWork = false; +var currentEventTransitionLane = NoLanes; function ensureRootIsScheduled(root) { // This function is called whenever a root receives an update. It does two // things 1) it ensures the root is in the root schedule, and 2) it ensures @@ -20120,6 +20124,14 @@ function processRootScheduleInMicrotask() { while (root !== null) { var next = root.next; + + if ( + currentEventTransitionLane !== NoLane && + shouldAttemptEagerTransition() + ) { + markRootEntangled(root, mergeLanes(currentEventTransitionLane, SyncLane)); + } + var nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); if (nextLanes === NoLane) { @@ -20151,7 +20163,9 @@ function processRootScheduleInMicrotask() { } root = next; - } // At the end of the microtask, flush any pending synchronous work. This has + } + + currentEventTransitionLane = NoLane; // At the end of the microtask, flush any pending synchronous work. This has // to come at the end, because it does actual rendering work that might throw. flushSyncWorkOnAllRoots(); @@ -20324,6 +20338,13 @@ function scheduleImmediateTask(cb) { } } +function getCurrentEventTransitionLane() { + return currentEventTransitionLane; +} +function setCurrentEventTransitionLane(lane) { + currentEventTransitionLane = lane; +} + var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map; var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, @@ -20438,7 +20459,6 @@ var didScheduleUpdateDuringPassiveEffects = false; var NESTED_PASSIVE_UPDATE_LIMIT = 50; var nestedPassiveUpdateCount = 0; var rootWithPassiveNestedUpdates = null; -var currentEventTransitionLane = NoLanes; var isRunningInsertionEffect = false; function getWorkInProgressRoot() { return workInProgressRoot; @@ -20490,12 +20510,12 @@ function requestUpdateLane(fiber) { // event. Then reset the cached values once we can be sure the event is // over. Our heuristic for that is whenever we enter a concurrent work loop. - if (currentEventTransitionLane === NoLane) { + if (getCurrentEventTransitionLane() === NoLane) { // All transitions within the same event are assigned the same lane. - currentEventTransitionLane = claimNextTransitionLane(); + setCurrentEventTransitionLane(claimNextTransitionLane()); } - return currentEventTransitionLane; + return getCurrentEventTransitionLane(); } // Updates originating inside certain React methods, like flushSync, have // their priority set by tracking it with a context variable. // @@ -20626,8 +20646,6 @@ function performConcurrentWorkOnRoot(root, didTimeout) { resetNestedUpdateFlag(); } - currentEventTransitionLane = NoLanes; - if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { throw new Error("Should not already be working."); } // Flush any pending passive effects before deciding which lanes to work on, @@ -24337,7 +24355,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-cadbd8dc"; +var ReactVersion = "18.3.0-www-classic-db63790a"; // Might add PROFILE later. diff --git a/compiled/facebook-www/ReactTestRenderer-dev.modern.js b/compiled/facebook-www/ReactTestRenderer-dev.modern.js index 0b7790b522..41c63500eb 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.modern.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.modern.js @@ -2052,6 +2052,9 @@ function createTextInstance( function getCurrentEventPriority() { return DefaultEventPriority; } +function shouldAttemptEagerTransition() { + return false; +} var scheduleTimeout = setTimeout; var cancelTimeout = clearTimeout; var noTimeout = -1; // ------------------- @@ -19970,6 +19973,7 @@ var didScheduleMicrotask_act = false; // Used to quickly bail out of flushSync i var mightHavePendingSyncWork = false; var isFlushingWork = false; +var currentEventTransitionLane = NoLanes; function ensureRootIsScheduled(root) { // This function is called whenever a root receives an update. It does two // things 1) it ensures the root is in the root schedule, and 2) it ensures @@ -20120,6 +20124,14 @@ function processRootScheduleInMicrotask() { while (root !== null) { var next = root.next; + + if ( + currentEventTransitionLane !== NoLane && + shouldAttemptEagerTransition() + ) { + markRootEntangled(root, mergeLanes(currentEventTransitionLane, SyncLane)); + } + var nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); if (nextLanes === NoLane) { @@ -20151,7 +20163,9 @@ function processRootScheduleInMicrotask() { } root = next; - } // At the end of the microtask, flush any pending synchronous work. This has + } + + currentEventTransitionLane = NoLane; // At the end of the microtask, flush any pending synchronous work. This has // to come at the end, because it does actual rendering work that might throw. flushSyncWorkOnAllRoots(); @@ -20324,6 +20338,13 @@ function scheduleImmediateTask(cb) { } } +function getCurrentEventTransitionLane() { + return currentEventTransitionLane; +} +function setCurrentEventTransitionLane(lane) { + currentEventTransitionLane = lane; +} + var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map; var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, @@ -20438,7 +20459,6 @@ var didScheduleUpdateDuringPassiveEffects = false; var NESTED_PASSIVE_UPDATE_LIMIT = 50; var nestedPassiveUpdateCount = 0; var rootWithPassiveNestedUpdates = null; -var currentEventTransitionLane = NoLanes; var isRunningInsertionEffect = false; function getWorkInProgressRoot() { return workInProgressRoot; @@ -20490,12 +20510,12 @@ function requestUpdateLane(fiber) { // event. Then reset the cached values once we can be sure the event is // over. Our heuristic for that is whenever we enter a concurrent work loop. - if (currentEventTransitionLane === NoLane) { + if (getCurrentEventTransitionLane() === NoLane) { // All transitions within the same event are assigned the same lane. - currentEventTransitionLane = claimNextTransitionLane(); + setCurrentEventTransitionLane(claimNextTransitionLane()); } - return currentEventTransitionLane; + return getCurrentEventTransitionLane(); } // Updates originating inside certain React methods, like flushSync, have // their priority set by tracking it with a context variable. // @@ -20626,8 +20646,6 @@ function performConcurrentWorkOnRoot(root, didTimeout) { resetNestedUpdateFlag(); } - currentEventTransitionLane = NoLanes; - if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { throw new Error("Should not already be working."); } // Flush any pending passive effects before deciding which lanes to work on, @@ -24337,7 +24355,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-50a23993"; +var ReactVersion = "18.3.0-www-modern-40ddfb33"; // Might add PROFILE later.