Synchronously flush the transition lane scheduled in a popstate event (#26025)

<!--
  Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please
provide enough information so that others can review your pull request.
The three fields below are mandatory.

Before submitting a pull request, please make sure the following is
done:

1. Fork [the repository](https://github.com/facebook/react) and create
your branch from `main`.
  2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch
TestName` is helpful in development.
5. Run `yarn test --prod` to test in the production environment. It
supports the same options as `yarn test`.
6. If you need a debugger, run `yarn debug-test --watch TestName`, open
`chrome://inspect`, and press "Inspect".
7. Format your code with
[prettier](https://github.com/prettier/prettier) (`yarn prettier`).
8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only
check changed files.
  9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
  10. If you haven't already, complete the CLA.

Learn more about contributing:
https://reactjs.org/docs/how-to-contribute.html
-->

## 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 commit https://github.com/facebook/react/commit/d121c67004a2e6b0bb5d341843663ef213f64863.
This commit is contained in:
acdlite
2023-04-13 19:26:10 +00:00
parent 79f5d01b38
commit 9e0082bbad
13 changed files with 182 additions and 128 deletions
@@ -1947,6 +1947,9 @@ function createTextInstance(
function getCurrentEventPriority() {
return DefaultEventPriority;
}
function shouldAttemptEagerTransition() {
return false;
}
var scheduleTimeout = setTimeout;
var cancelTimeout = clearTimeout;
var noTimeout = -1; // -------------------
@@ -19378,6 +19381,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
@@ -19528,6 +19532,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) {
@@ -19559,7 +19571,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();
@@ -19732,6 +19746,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,
@@ -19846,7 +19867,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;
@@ -19898,12 +19918,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.
//
@@ -20034,8 +20054,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,
@@ -23727,7 +23745,7 @@ function createFiberRoot(
return root;
}
var ReactVersion = "18.3.0-next-7b0642bb9-20230412";
var ReactVersion = "18.3.0-next-d121c6700-20230413";
// Might add PROFILE later.
@@ -6165,7 +6165,8 @@ var DefaultCacheDispatcher = {
lastScheduledRoot = null,
didScheduleMicrotask = !1,
mightHavePendingSyncWork = !1,
isFlushingWork = !1;
isFlushingWork = !1,
currentEventTransitionLane = 0;
function ensureRootIsScheduled(root) {
root !== lastScheduledRoot &&
null === root.next &&
@@ -6282,6 +6283,7 @@ function processRootScheduleInMicrotask() {
0 !== (nextLanes & 3) && (mightHavePendingSyncWork = !0));
root = next;
}
currentEventTransitionLane = 0;
flushSyncWorkAcrossRoots_impl(!1);
}
function scheduleTaskForRootDuringMicrotask(root, currentTime) {
@@ -6387,8 +6389,7 @@ var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map,
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)
@@ -6424,7 +6425,6 @@ function scheduleUpdateOnFiber(root, fiber, lane) {
flushSyncWorkAcrossRoots_impl(!0));
}
function performConcurrentWorkOnRoot(root, didTimeout) {
currentEventTransitionLane = 0;
if (0 !== (executionContext & 6))
throw Error("Should not already be working.");
var originalCallbackNode = root.callbackNode;
@@ -8582,19 +8582,19 @@ function wrapFiber(fiber) {
fiberToWrapper.set(fiber, wrapper));
return wrapper;
}
var devToolsConfig$jscomp$inline_1021 = {
var devToolsConfig$jscomp$inline_1023 = {
findFiberByHostInstance: function () {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-next-7b0642bb9-20230412",
version: "18.3.0-next-d121c6700-20230413",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1204 = {
bundleType: devToolsConfig$jscomp$inline_1021.bundleType,
version: devToolsConfig$jscomp$inline_1021.version,
rendererPackageName: devToolsConfig$jscomp$inline_1021.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1021.rendererConfig,
var internals$jscomp$inline_1206 = {
bundleType: devToolsConfig$jscomp$inline_1023.bundleType,
version: devToolsConfig$jscomp$inline_1023.version,
rendererPackageName: devToolsConfig$jscomp$inline_1023.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1023.rendererConfig,
overrideHookState: null,
overrideHookStateDeletePath: null,
overrideHookStateRenamePath: null,
@@ -8611,26 +8611,26 @@ var internals$jscomp$inline_1204 = {
return null === fiber ? null : fiber.stateNode;
},
findFiberByHostInstance:
devToolsConfig$jscomp$inline_1021.findFiberByHostInstance ||
devToolsConfig$jscomp$inline_1023.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
findHostInstancesForRefresh: null,
scheduleRefresh: null,
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-7b0642bb9-20230412"
reconcilerVersion: "18.3.0-next-d121c6700-20230413"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1205 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
var hook$jscomp$inline_1207 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (
!hook$jscomp$inline_1205.isDisabled &&
hook$jscomp$inline_1205.supportsFiber
!hook$jscomp$inline_1207.isDisabled &&
hook$jscomp$inline_1207.supportsFiber
)
try {
(rendererID = hook$jscomp$inline_1205.inject(
internals$jscomp$inline_1204
(rendererID = hook$jscomp$inline_1207.inject(
internals$jscomp$inline_1206
)),
(injectedHook = hook$jscomp$inline_1205);
(injectedHook = hook$jscomp$inline_1207);
} catch (err) {}
}
exports._Scheduler = Scheduler;
@@ -6501,7 +6501,8 @@ var DefaultCacheDispatcher = {
lastScheduledRoot = null,
didScheduleMicrotask = !1,
mightHavePendingSyncWork = !1,
isFlushingWork = !1;
isFlushingWork = !1,
currentEventTransitionLane = 0;
function ensureRootIsScheduled(root) {
root !== lastScheduledRoot &&
null === root.next &&
@@ -6620,6 +6621,7 @@ function processRootScheduleInMicrotask() {
0 !== (nextLanes & 3) && (mightHavePendingSyncWork = !0));
root = next;
}
currentEventTransitionLane = 0;
flushSyncWorkAcrossRoots_impl(!1);
}
function scheduleTaskForRootDuringMicrotask(root, currentTime) {
@@ -6726,8 +6728,7 @@ var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map,
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)
@@ -6764,7 +6765,6 @@ function scheduleUpdateOnFiber(root, fiber, lane) {
}
function performConcurrentWorkOnRoot(root, didTimeout) {
nestedUpdateScheduled = currentUpdateIsNested = !1;
currentEventTransitionLane = 0;
if (0 !== (executionContext & 6))
throw Error("Should not already be working.");
var originalCallbackNode = root.callbackNode;
@@ -9008,19 +9008,19 @@ function wrapFiber(fiber) {
fiberToWrapper.set(fiber, wrapper));
return wrapper;
}
var devToolsConfig$jscomp$inline_1063 = {
var devToolsConfig$jscomp$inline_1065 = {
findFiberByHostInstance: function () {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-next-7b0642bb9-20230412",
version: "18.3.0-next-d121c6700-20230413",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1245 = {
bundleType: devToolsConfig$jscomp$inline_1063.bundleType,
version: devToolsConfig$jscomp$inline_1063.version,
rendererPackageName: devToolsConfig$jscomp$inline_1063.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1063.rendererConfig,
var internals$jscomp$inline_1247 = {
bundleType: devToolsConfig$jscomp$inline_1065.bundleType,
version: devToolsConfig$jscomp$inline_1065.version,
rendererPackageName: devToolsConfig$jscomp$inline_1065.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1065.rendererConfig,
overrideHookState: null,
overrideHookStateDeletePath: null,
overrideHookStateRenamePath: null,
@@ -9037,26 +9037,26 @@ var internals$jscomp$inline_1245 = {
return null === fiber ? null : fiber.stateNode;
},
findFiberByHostInstance:
devToolsConfig$jscomp$inline_1063.findFiberByHostInstance ||
devToolsConfig$jscomp$inline_1065.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
findHostInstancesForRefresh: null,
scheduleRefresh: null,
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-7b0642bb9-20230412"
reconcilerVersion: "18.3.0-next-d121c6700-20230413"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1246 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
var hook$jscomp$inline_1248 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (
!hook$jscomp$inline_1246.isDisabled &&
hook$jscomp$inline_1246.supportsFiber
!hook$jscomp$inline_1248.isDisabled &&
hook$jscomp$inline_1248.supportsFiber
)
try {
(rendererID = hook$jscomp$inline_1246.inject(
internals$jscomp$inline_1245
(rendererID = hook$jscomp$inline_1248.inject(
internals$jscomp$inline_1247
)),
(injectedHook = hook$jscomp$inline_1246);
(injectedHook = hook$jscomp$inline_1248);
} catch (err) {}
}
exports._Scheduler = Scheduler;
@@ -27,7 +27,7 @@ if (
}
"use strict";
var ReactVersion = "18.3.0-next-7b0642bb9-20230412";
var ReactVersion = "18.3.0-next-d121c6700-20230413";
// ATTENTION
// When adding new symbols to this file,
@@ -639,4 +639,4 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-next-7b0642bb9-20230412";
exports.version = "18.3.0-next-d121c6700-20230413";
@@ -642,7 +642,7 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-next-7b0642bb9-20230412";
exports.version = "18.3.0-next-d121c6700-20230413";
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
@@ -1 +1 @@
7b0642bb989ec659c6c9891ea16daa0420caab4d
d121c67004a2e6b0bb5d341843663ef213f64863
@@ -5005,6 +5005,9 @@ function getCurrentEventPriority() {
}
return DefaultEventPriority;
}
function shouldAttemptEagerTransition() {
return false;
} // The Fabric renderer is secondary to the existing React Native renderer.
var warnsIfNotActing = false;
@@ -22470,6 +22473,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
@@ -22628,6 +22632,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) {
@@ -22659,7 +22671,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();
@@ -22832,6 +22846,13 @@ function scheduleImmediateTask(cb) {
}
}
function getCurrentEventTransitionLane() {
return currentEventTransitionLane;
}
function setCurrentEventTransitionLane(lane) {
currentEventTransitionLane = lane;
}
var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher,
ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner,
@@ -22943,7 +22964,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;
@@ -22995,12 +23015,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.
//
@@ -23139,8 +23159,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,
@@ -27034,7 +27052,7 @@ function createFiberRoot(
return root;
}
var ReactVersion = "18.3.0-next-7b0642bb9-20230412";
var ReactVersion = "18.3.0-next-d121c6700-20230413";
function createPortal$1(
children,
@@ -7273,7 +7273,8 @@ var firstScheduledRoot = null,
lastScheduledRoot = null,
didScheduleMicrotask = !1,
mightHavePendingSyncWork = !1,
isFlushingWork = !1;
isFlushingWork = !1,
currentEventTransitionLane = 0;
function ensureRootIsScheduled(root) {
root !== lastScheduledRoot &&
null === root.next &&
@@ -7392,6 +7393,7 @@ function processRootScheduleInMicrotask() {
0 !== (nextLanes & 3) && (mightHavePendingSyncWork = !0));
root = next;
}
currentEventTransitionLane = 0;
flushSyncWorkAcrossRoots_impl(!1);
}
function scheduleTaskForRootDuringMicrotask(root, currentTime) {
@@ -7494,8 +7496,7 @@ var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map,
rootWithPendingPassiveEffects = null,
pendingPassiveEffectsLanes = 0,
nestedUpdateCount = 0,
rootWithNestedUpdates = null,
currentEventTransitionLane = 0;
rootWithNestedUpdates = null;
function requestUpdateLane(fiber) {
if (0 === (fiber.mode & 1)) return 2;
if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes)
@@ -7544,7 +7545,6 @@ function scheduleUpdateOnFiber(root, fiber, lane) {
flushSyncWorkAcrossRoots_impl(!0));
}
function performConcurrentWorkOnRoot(root, didTimeout) {
currentEventTransitionLane = 0;
if (0 !== (executionContext & 6))
throw Error("Should not already be working.");
var originalCallbackNode = root.callbackNode;
@@ -9453,10 +9453,10 @@ batchedUpdatesImpl = function (fn, a) {
}
};
var roots = new Map(),
devToolsConfig$jscomp$inline_1045 = {
devToolsConfig$jscomp$inline_1047 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "18.3.0-next-7b0642bb9-20230412",
version: "18.3.0-next-d121c6700-20230413",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
@@ -9471,11 +9471,11 @@ var roots = new Map(),
}.bind(null, findNodeHandle)
}
};
var internals$jscomp$inline_1274 = {
bundleType: devToolsConfig$jscomp$inline_1045.bundleType,
version: devToolsConfig$jscomp$inline_1045.version,
rendererPackageName: devToolsConfig$jscomp$inline_1045.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1045.rendererConfig,
var internals$jscomp$inline_1276 = {
bundleType: devToolsConfig$jscomp$inline_1047.bundleType,
version: devToolsConfig$jscomp$inline_1047.version,
rendererPackageName: devToolsConfig$jscomp$inline_1047.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1047.rendererConfig,
overrideHookState: null,
overrideHookStateDeletePath: null,
overrideHookStateRenamePath: null,
@@ -9491,26 +9491,26 @@ var internals$jscomp$inline_1274 = {
return null === fiber ? null : fiber.stateNode;
},
findFiberByHostInstance:
devToolsConfig$jscomp$inline_1045.findFiberByHostInstance ||
devToolsConfig$jscomp$inline_1047.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
findHostInstancesForRefresh: null,
scheduleRefresh: null,
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-7b0642bb9-20230412"
reconcilerVersion: "18.3.0-next-d121c6700-20230413"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1275 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
var hook$jscomp$inline_1277 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (
!hook$jscomp$inline_1275.isDisabled &&
hook$jscomp$inline_1275.supportsFiber
!hook$jscomp$inline_1277.isDisabled &&
hook$jscomp$inline_1277.supportsFiber
)
try {
(rendererID = hook$jscomp$inline_1275.inject(
internals$jscomp$inline_1274
(rendererID = hook$jscomp$inline_1277.inject(
internals$jscomp$inline_1276
)),
(injectedHook = hook$jscomp$inline_1275);
(injectedHook = hook$jscomp$inline_1277);
} catch (err) {}
}
exports.createPortal = function (children, containerTag) {
@@ -7799,7 +7799,8 @@ var firstScheduledRoot = null,
lastScheduledRoot = null,
didScheduleMicrotask = !1,
mightHavePendingSyncWork = !1,
isFlushingWork = !1;
isFlushingWork = !1,
currentEventTransitionLane = 0;
function ensureRootIsScheduled(root) {
root !== lastScheduledRoot &&
null === root.next &&
@@ -7920,6 +7921,7 @@ function processRootScheduleInMicrotask() {
0 !== (nextLanes & 3) && (mightHavePendingSyncWork = !0));
root = next;
}
currentEventTransitionLane = 0;
flushSyncWorkAcrossRoots_impl(!1);
}
function scheduleTaskForRootDuringMicrotask(root, currentTime) {
@@ -8023,8 +8025,7 @@ var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map,
pendingPassiveEffectsLanes = 0,
pendingPassiveProfilerEffects = [],
nestedUpdateCount = 0,
rootWithNestedUpdates = null,
currentEventTransitionLane = 0;
rootWithNestedUpdates = null;
function requestUpdateLane(fiber) {
if (0 === (fiber.mode & 1)) return 2;
if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes)
@@ -8075,7 +8076,6 @@ function scheduleUpdateOnFiber(root, fiber, lane) {
}
function performConcurrentWorkOnRoot(root, didTimeout) {
nestedUpdateScheduled = currentUpdateIsNested = !1;
currentEventTransitionLane = 0;
if (0 !== (executionContext & 6))
throw Error("Should not already be working.");
var originalCallbackNode = root.callbackNode;
@@ -10162,10 +10162,10 @@ batchedUpdatesImpl = function (fn, a) {
}
};
var roots = new Map(),
devToolsConfig$jscomp$inline_1123 = {
devToolsConfig$jscomp$inline_1125 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "18.3.0-next-7b0642bb9-20230412",
version: "18.3.0-next-d121c6700-20230413",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
@@ -10194,10 +10194,10 @@ var roots = new Map(),
} catch (err) {}
return hook.checkDCE ? !0 : !1;
})({
bundleType: devToolsConfig$jscomp$inline_1123.bundleType,
version: devToolsConfig$jscomp$inline_1123.version,
rendererPackageName: devToolsConfig$jscomp$inline_1123.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1123.rendererConfig,
bundleType: devToolsConfig$jscomp$inline_1125.bundleType,
version: devToolsConfig$jscomp$inline_1125.version,
rendererPackageName: devToolsConfig$jscomp$inline_1125.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1125.rendererConfig,
overrideHookState: null,
overrideHookStateDeletePath: null,
overrideHookStateRenamePath: null,
@@ -10213,14 +10213,14 @@ var roots = new Map(),
return null === fiber ? null : fiber.stateNode;
},
findFiberByHostInstance:
devToolsConfig$jscomp$inline_1123.findFiberByHostInstance ||
devToolsConfig$jscomp$inline_1125.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
findHostInstancesForRefresh: null,
scheduleRefresh: null,
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-7b0642bb9-20230412"
reconcilerVersion: "18.3.0-next-d121c6700-20230413"
});
exports.createPortal = function (children, containerTag) {
return createPortal$1(
@@ -5823,6 +5823,9 @@ function shouldSetTextContent(type, props) {
}
function getCurrentEventPriority() {
return DefaultEventPriority;
}
function shouldAttemptEagerTransition() {
return false;
} // -------------------
function appendChild(parentInstance, child) {
var childTag = typeof child === "number" ? child : child._nativeTag;
@@ -22983,6 +22986,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
@@ -23141,6 +23145,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) {
@@ -23172,7 +23184,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();
@@ -23345,6 +23359,13 @@ function scheduleImmediateTask(cb) {
}
}
function getCurrentEventTransitionLane() {
return currentEventTransitionLane;
}
function setCurrentEventTransitionLane(lane) {
currentEventTransitionLane = lane;
}
var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher,
ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner,
@@ -23456,7 +23477,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;
@@ -23508,12 +23528,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.
//
@@ -23652,8 +23672,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,
@@ -27547,7 +27565,7 @@ function createFiberRoot(
return root;
}
var ReactVersion = "18.3.0-next-7b0642bb9-20230412";
var ReactVersion = "18.3.0-next-d121c6700-20230413";
function createPortal$1(
children,
@@ -7538,7 +7538,8 @@ var firstScheduledRoot = null,
lastScheduledRoot = null,
didScheduleMicrotask = !1,
mightHavePendingSyncWork = !1,
isFlushingWork = !1;
isFlushingWork = !1,
currentEventTransitionLane = 0;
function ensureRootIsScheduled(root) {
root !== lastScheduledRoot &&
null === root.next &&
@@ -7657,6 +7658,7 @@ function processRootScheduleInMicrotask() {
0 !== (nextLanes & 3) && (mightHavePendingSyncWork = !0));
root = next;
}
currentEventTransitionLane = 0;
flushSyncWorkAcrossRoots_impl(!1);
}
function scheduleTaskForRootDuringMicrotask(root, currentTime) {
@@ -7759,8 +7761,7 @@ var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map,
rootWithPendingPassiveEffects = null,
pendingPassiveEffectsLanes = 0,
nestedUpdateCount = 0,
rootWithNestedUpdates = null,
currentEventTransitionLane = 0;
rootWithNestedUpdates = null;
function requestUpdateLane(fiber) {
if (0 === (fiber.mode & 1)) return 2;
if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes)
@@ -7796,7 +7797,6 @@ function scheduleUpdateOnFiber(root, fiber, lane) {
flushSyncWorkAcrossRoots_impl(!0));
}
function performConcurrentWorkOnRoot(root, didTimeout) {
currentEventTransitionLane = 0;
if (0 !== (executionContext & 6))
throw Error("Should not already be working.");
var originalCallbackNode = root.callbackNode;
@@ -9712,10 +9712,10 @@ batchedUpdatesImpl = function (fn, a) {
}
};
var roots = new Map(),
devToolsConfig$jscomp$inline_1100 = {
devToolsConfig$jscomp$inline_1102 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "18.3.0-next-7b0642bb9-20230412",
version: "18.3.0-next-d121c6700-20230413",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
@@ -9730,11 +9730,11 @@ var roots = new Map(),
}.bind(null, findNodeHandle)
}
};
var internals$jscomp$inline_1343 = {
bundleType: devToolsConfig$jscomp$inline_1100.bundleType,
version: devToolsConfig$jscomp$inline_1100.version,
rendererPackageName: devToolsConfig$jscomp$inline_1100.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1100.rendererConfig,
var internals$jscomp$inline_1345 = {
bundleType: devToolsConfig$jscomp$inline_1102.bundleType,
version: devToolsConfig$jscomp$inline_1102.version,
rendererPackageName: devToolsConfig$jscomp$inline_1102.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1102.rendererConfig,
overrideHookState: null,
overrideHookStateDeletePath: null,
overrideHookStateRenamePath: null,
@@ -9750,26 +9750,26 @@ var internals$jscomp$inline_1343 = {
return null === fiber ? null : fiber.stateNode;
},
findFiberByHostInstance:
devToolsConfig$jscomp$inline_1100.findFiberByHostInstance ||
devToolsConfig$jscomp$inline_1102.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
findHostInstancesForRefresh: null,
scheduleRefresh: null,
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-7b0642bb9-20230412"
reconcilerVersion: "18.3.0-next-d121c6700-20230413"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1344 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
var hook$jscomp$inline_1346 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (
!hook$jscomp$inline_1344.isDisabled &&
hook$jscomp$inline_1344.supportsFiber
!hook$jscomp$inline_1346.isDisabled &&
hook$jscomp$inline_1346.supportsFiber
)
try {
(rendererID = hook$jscomp$inline_1344.inject(
internals$jscomp$inline_1343
(rendererID = hook$jscomp$inline_1346.inject(
internals$jscomp$inline_1345
)),
(injectedHook = hook$jscomp$inline_1344);
(injectedHook = hook$jscomp$inline_1346);
} catch (err) {}
}
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
@@ -8064,7 +8064,8 @@ var firstScheduledRoot = null,
lastScheduledRoot = null,
didScheduleMicrotask = !1,
mightHavePendingSyncWork = !1,
isFlushingWork = !1;
isFlushingWork = !1,
currentEventTransitionLane = 0;
function ensureRootIsScheduled(root) {
root !== lastScheduledRoot &&
null === root.next &&
@@ -8185,6 +8186,7 @@ function processRootScheduleInMicrotask() {
0 !== (nextLanes & 3) && (mightHavePendingSyncWork = !0));
root = next;
}
currentEventTransitionLane = 0;
flushSyncWorkAcrossRoots_impl(!1);
}
function scheduleTaskForRootDuringMicrotask(root, currentTime) {
@@ -8288,8 +8290,7 @@ var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map,
pendingPassiveEffectsLanes = 0,
pendingPassiveProfilerEffects = [],
nestedUpdateCount = 0,
rootWithNestedUpdates = null,
currentEventTransitionLane = 0;
rootWithNestedUpdates = null;
function requestUpdateLane(fiber) {
if (0 === (fiber.mode & 1)) return 2;
if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes)
@@ -8327,7 +8328,6 @@ function scheduleUpdateOnFiber(root, fiber, lane) {
}
function performConcurrentWorkOnRoot(root, didTimeout) {
nestedUpdateScheduled = currentUpdateIsNested = !1;
currentEventTransitionLane = 0;
if (0 !== (executionContext & 6))
throw Error("Should not already be working.");
var originalCallbackNode = root.callbackNode;
@@ -10421,10 +10421,10 @@ batchedUpdatesImpl = function (fn, a) {
}
};
var roots = new Map(),
devToolsConfig$jscomp$inline_1178 = {
devToolsConfig$jscomp$inline_1180 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "18.3.0-next-7b0642bb9-20230412",
version: "18.3.0-next-d121c6700-20230413",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
@@ -10453,10 +10453,10 @@ var roots = new Map(),
} catch (err) {}
return hook.checkDCE ? !0 : !1;
})({
bundleType: devToolsConfig$jscomp$inline_1178.bundleType,
version: devToolsConfig$jscomp$inline_1178.version,
rendererPackageName: devToolsConfig$jscomp$inline_1178.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1178.rendererConfig,
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,
@@ -10472,14 +10472,14 @@ var roots = new Map(),
return null === fiber ? null : fiber.stateNode;
},
findFiberByHostInstance:
devToolsConfig$jscomp$inline_1178.findFiberByHostInstance ||
devToolsConfig$jscomp$inline_1180.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
findHostInstancesForRefresh: null,
scheduleRefresh: null,
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-7b0642bb9-20230412"
reconcilerVersion: "18.3.0-next-d121c6700-20230413"
});
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
computeComponentStackForErrorReporting: function (reactTag) {