From 2785ce7e612fbf1b7cbe01d44c2a0b65546241b8 Mon Sep 17 00:00:00 2001 From: Kacie Bawiec Date: Tue, 6 Apr 2021 12:41:05 -0700 Subject: [PATCH] React Native sync for revisions 6d3ecb7...c9aab1c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: This sync includes the following changes: - **[c9aab1c9d](https://github.com/facebook/react/commit/c9aab1c9d )**: react-refresh@0.10.0 //// - **[516b76b9a](https://github.com/facebook/react/commit/516b76b9a )**: [Fast Refresh] Support callthrough HOCs ([#21104](https://github.com/facebook/react/pull/21104)) //// - **[0853aab74](https://github.com/facebook/react/commit/0853aab74 )**: Log all errors to console.error by default ([#21130](https://github.com/facebook/react/pull/21130)) //// - **[d1294c9d4](https://github.com/facebook/react/commit/d1294c9d4 )**: Add global onError handler ([#21129](https://github.com/facebook/react/pull/21129)) //// - **[64983aab5](https://github.com/facebook/react/commit/64983aab5 )**: Remove redundant setUpdatePriority call ([#21127](https://github.com/facebook/react/pull/21127)) //// - **[634cc52e6](https://github.com/facebook/react/commit/634cc52e6 )**: Delete dead variable: currentEventWipLanes ([#21123](https://github.com/facebook/react/pull/21123)) //// - **[1102224bb](https://github.com/facebook/react/commit/1102224bb )**: Fix: flushSync changes priority inside effect ([#21122](https://github.com/facebook/react/pull/21122)) //// - **[dbe98a5aa](https://github.com/facebook/react/commit/dbe98a5aa )**: Move sync task queue to its own module ([#21109](https://github.com/facebook/react/pull/21109)) //// - **[3ba5c8737](https://github.com/facebook/react/commit/3ba5c8737 )**: Remove Scheduler indirection ([#21107](https://github.com/facebook/react/pull/21107)) //// - **[46b68eaf6](https://github.com/facebook/react/commit/46b68eaf6 )**: Delete LanePriority type ([#21090](https://github.com/facebook/react/pull/21090)) //// - **[dcd13045e](https://github.com/facebook/react/commit/dcd13045e )**: Use Lane to track root callback priority ([#21089](https://github.com/facebook/react/pull/21089)) //// - **[5f21a9fca](https://github.com/facebook/react/commit/5f21a9fca )**: Clean up host pointers in level 2 of clean-up flag ([#21112](https://github.com/facebook/react/pull/21112)) //// - **[32d6f39ed](https://github.com/facebook/react/commit/32d6f39ed )**: [Fizz] Support special HTML/SVG/MathML tags to suspend ([#21113](https://github.com/facebook/react/pull/21113)) //// - **[a77dd13ed](https://github.com/facebook/react/commit/a77dd13ed )**: Delete enableDiscreteEventFlushingChange ([#21110](https://github.com/facebook/react/pull/21110)) //// - **[048ee4c0c](https://github.com/facebook/react/commit/048ee4c0c )**: Use `act` in fuzz tester to flush expired work ([#21108](https://github.com/facebook/react/pull/21108)) //// - **[556644e23](https://github.com/facebook/react/commit/556644e23 )**: Fix plurals ([#21106](https://github.com/facebook/react/pull/21106)) //// - **[8b741437b](https://github.com/facebook/react/commit/8b741437b )**: Rename SuspendedWork to Task ([#21105](https://github.com/facebook/react/pull/21105)) //// - **[38a1aedb4](https://github.com/facebook/react/commit/38a1aedb4 )**: [Fizz] Add FormatContext and Refactor Work ([#21103](https://github.com/facebook/react/pull/21103)) //// - **[1b7e471b9](https://github.com/facebook/react/commit/1b7e471b9 )**: React Native New Architecture: Support passing nativeViewTag to getInspectorDataForViewAtPoint callback, for React DevTools compat ([#21080](https://github.com/facebook/react/pull/21080)) //// - **[4a99c5c3a](https://github.com/facebook/react/commit/4a99c5c3a )**: Use highest priority lane to detect interruptions ([#21088](https://github.com/facebook/react/pull/21088)) //// - **[77be52729](https://github.com/facebook/react/commit/77be52729 )**: Remove LanePriority from computeExpirationTime ([#21087](https://github.com/facebook/react/pull/21087)) //// - **[3221e8fba](https://github.com/facebook/react/commit/3221e8fba )**: Remove LanePriority from getBumpedLaneForHydration ([#21086](https://github.com/facebook/react/pull/21086)) //// - **[05ec0d764](https://github.com/facebook/react/commit/05ec0d764 )**: Entangled expired lanes with SyncLane ([#21083](https://github.com/facebook/react/pull/21083)) //// - **[03ede83d2](https://github.com/facebook/react/commit/03ede83d2 )**: Use EventPriority to track update priority ([#21082](https://github.com/facebook/react/pull/21082)) //// - **[a63f0953b](https://github.com/facebook/react/commit/a63f0953b )**: Delete SyncBatchedLane ([#21061](https://github.com/facebook/react/pull/21061)) //// - **[fa868d6be](https://github.com/facebook/react/commit/fa868d6be )**: Make opaque EventPriority type a Lane internally ([#21065](https://github.com/facebook/react/pull/21065)) //// - **[eb58c3909](https://github.com/facebook/react/commit/eb58c3909 )**: react-hooks/exhaustive-deps: Handle optional chained methods as dependency ([#20204](https://github.com/facebook/react/pull/20204)) ([#20247](https://github.com/facebook/react/pull/20247)) //// - **[7b84dbd16](https://github.com/facebook/react/commit/7b84dbd16 )**: Fail build on deep requires in npm packages ([#21063](https://github.com/facebook/react/pull/21063)) //// - **[2c9d8efc8](https://github.com/facebook/react/commit/2c9d8efc8 )**: Add react-reconciler/constants entry point ([#21062](https://github.com/facebook/react/pull/21062)) //// - **[d0eaf7829](https://github.com/facebook/react/commit/d0eaf7829 )**: Move priorities to separate import to break cycle ([#21060](https://github.com/facebook/react/pull/21060)) //// - **[435cff986](https://github.com/facebook/react/commit/435cff986 )**: [Fizz] Expose callbacks in options for when various stages of the content is done ([#21056](https://github.com/facebook/react/pull/21056)) //// - **[25bfa287f](https://github.com/facebook/react/commit/25bfa287f )**: [Experiment] Add feature flag for more aggressive memory clean-up of deleted fiber trees ([#21039](https://github.com/facebook/react/pull/21039)) //// - **[8fe7810e7](https://github.com/facebook/react/commit/8fe7810e7 )**: Remove already completed comment ([#21054](https://github.com/facebook/react/pull/21054)) //// - **[6c3202b1e](https://github.com/facebook/react/commit/6c3202b1e )**: [Fizz] Use identifierPrefix to avoid conflicts within the same response ([#21037](https://github.com/facebook/react/pull/21037)) //// - **[dcdf8de7e](https://github.com/facebook/react/commit/dcdf8de7e )**: Remove discrete lanes and priorities ([#21040](https://github.com/facebook/react/pull/21040)) //// - **[ca99ae97b](https://github.com/facebook/react/commit/ca99ae97b )**: Replace some flushExpired callsites ([#20975](https://github.com/facebook/react/pull/20975)) //// - **[1fafac002](https://github.com/facebook/react/commit/1fafac002 )**: Use SyncLane for discrete event hydration ([#21038](https://github.com/facebook/react/pull/21038)) //// Changelog: [General][Changed] - React Native sync for revisions 6d3ecb7...c9aab1c jest_e2e[run_all_tests] Reviewed By: JoshuaGross Differential Revision: D27436763 fbshipit-source-id: da79a41e26bffdcdacd293178062edf098e9b58a --- Libraries/Renderer/REVISION | 2 +- .../implementations/ReactFabric-dev.fb.js | 1026 ++++++++-------- .../implementations/ReactFabric-prod.fb.js | 610 +++++----- .../ReactFabric-profiling.fb.js | 670 +++++------ .../ReactNativeRenderer-dev.fb.js | 1033 ++++++++--------- .../ReactNativeRenderer-prod.fb.js | 656 +++++------ .../ReactNativeRenderer-profiling.fb.js | 716 ++++++------ package.json | 4 +- packages/rn-tester/package.json | 2 +- repo-config/package.json | 4 +- template/package.json | 2 +- yarn.lock | 33 +- 12 files changed, 2189 insertions(+), 2569 deletions(-) diff --git a/Libraries/Renderer/REVISION b/Libraries/Renderer/REVISION index 81bd3d162e3e86..35a6ff2d75f5a7 100644 --- a/Libraries/Renderer/REVISION +++ b/Libraries/Renderer/REVISION @@ -1 +1 @@ -6d3ecb70dceb225af0cd990b46d6c44b852c1d82 \ No newline at end of file +c9aab1c9d00ce407b1c61c385b356d49cd147f60 \ No newline at end of file diff --git a/Libraries/Renderer/implementations/ReactFabric-dev.fb.js b/Libraries/Renderer/implementations/ReactFabric-dev.fb.js index 9791750eaf3542..177533bae2082b 100644 --- a/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +++ b/Libraries/Renderer/implementations/ReactFabric-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<8a3debf89e0aa436d3b070d7f4263199>> + * @generated SignedSource<<7d94bdf10150fe93a2e9fa8bbf998840>> */ 'use strict'; @@ -3830,162 +3830,6 @@ function dispatchEvent(target, topLevelType, nativeEvent) { // where it would do it. } -// Intentionally not named imports because Rollup would use dynamic dispatch for -var Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback, - Scheduler_cancelCallback = Scheduler.unstable_cancelCallback, - Scheduler_shouldYield = Scheduler.unstable_shouldYield, - Scheduler_requestPaint = Scheduler.unstable_requestPaint, - Scheduler_now = Scheduler.unstable_now, - Scheduler_ImmediatePriority = Scheduler.unstable_ImmediatePriority, - Scheduler_UserBlockingPriority = Scheduler.unstable_UserBlockingPriority, - Scheduler_NormalPriority = Scheduler.unstable_NormalPriority, - Scheduler_LowPriority = Scheduler.unstable_LowPriority, - Scheduler_IdlePriority = Scheduler.unstable_IdlePriority; - -{ - // Provide explicit error message when production+profiling bundle of e.g. - // react-dom is used with production (non-profiling) bundle of - // scheduler/tracing - if ( - !( - tracing.__interactionsRef != null && - tracing.__interactionsRef.current != null - ) - ) { - throw Error( - "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at https://reactjs.org/link/profiling" - ); - } -} - -// Except for NoPriority, these correspond to Scheduler priorities. We use -// ascending numbers so we can compare them like numbers. They start at 90 to -// avoid clashing with Scheduler's priorities. -var ImmediatePriority = 99; -var UserBlockingPriority = 98; -var NormalPriority = 97; -var LowPriority = 96; -var IdlePriority = 95; // NoPriority is the absence of priority. Also React-only. - -var NoPriority = 90; -var shouldYield = Scheduler_shouldYield; -var requestPaint = // Fall back gracefully if we're running an older version of Scheduler. - Scheduler_requestPaint !== undefined ? Scheduler_requestPaint : function() {}; -var syncQueue = null; -var isFlushingSyncQueue = false; -var initialTimeMs = Scheduler_now(); // If the initial timestamp is reasonably small, use Scheduler's `now` directly. -// This will be the case for modern browsers that support `performance.now`. In -// older browsers, Scheduler falls back to `Date.now`, which returns a Unix -// timestamp. In that case, subtract the module initialization time to simulate -// the behavior of performance.now and keep our times small enough to fit -// within 32 bits. -// TODO: Consider lifting this into Scheduler. - -var now = - initialTimeMs < 10000 - ? Scheduler_now - : function() { - return Scheduler_now() - initialTimeMs; - }; - -function reactPriorityToSchedulerPriority(reactPriorityLevel) { - switch (reactPriorityLevel) { - case ImmediatePriority: - return Scheduler_ImmediatePriority; - - case UserBlockingPriority: - return Scheduler_UserBlockingPriority; - - case NormalPriority: - return Scheduler_NormalPriority; - - case LowPriority: - return Scheduler_LowPriority; - - case IdlePriority: - return Scheduler_IdlePriority; - - default: { - throw Error("Unknown priority level."); - } - } -} - -function scheduleCallback(reactPriorityLevel, callback, options) { - var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); - return Scheduler_scheduleCallback(priorityLevel, callback, options); -} -function scheduleSyncCallback(callback) { - // Push this callback into an internal queue. We'll flush these either in - // the next tick, or earlier if something calls `flushSyncCallbackQueue`. - if (syncQueue === null) { - syncQueue = [callback]; - } else { - // Push onto existing queue. Don't need to schedule a callback because - // we already scheduled one when we created the queue. - syncQueue.push(callback); - } -} -function cancelCallback(callbackNode) { - Scheduler_cancelCallback(callbackNode); -} -function flushSyncCallbackQueue() { - if (!isFlushingSyncQueue && syncQueue !== null) { - // Prevent re-entrancy. - isFlushingSyncQueue = true; - var i = 0; - var previousLanePriority = getCurrentUpdateLanePriority(); - - try { - var _isSync = true; - var queue = syncQueue; - setCurrentUpdateLanePriority(SyncLanePriority); - - for (; i < queue.length; i++) { - var callback = queue[i]; - - do { - callback = callback(_isSync); - } while (callback !== null); - } - - syncQueue = null; - } catch (error) { - // If something throws, leave the remaining callbacks on the queue. - if (syncQueue !== null) { - syncQueue = syncQueue.slice(i + 1); - } // Resume flushing in the next tick - - Scheduler_scheduleCallback( - Scheduler_ImmediatePriority, - flushSyncCallbackQueue - ); - throw error; - } finally { - setCurrentUpdateLanePriority(previousLanePriority); - isFlushingSyncQueue = false; - } - } - - return null; -} - -var SyncLanePriority = 15; -var SyncBatchedLanePriority = 14; -var InputDiscreteHydrationLanePriority = 13; -var InputDiscreteLanePriority = 12; -var InputContinuousHydrationLanePriority = 11; -var InputContinuousLanePriority = 10; -var DefaultHydrationLanePriority = 9; -var DefaultLanePriority = 8; -var TransitionHydrationPriority = 7; -var TransitionPriority = 6; -var RetryLanePriority = 5; -var SelectiveHydrationLanePriority = 4; -var IdleHydrationLanePriority = 3; -var IdleLanePriority = 2; -var OffscreenLanePriority = 1; -var NoLanePriority = 0; // Lane values below should be kept in sync with getLabelsForLanes(), used by react-devtools-scheduling-profiler. // If those values are changed that package should be rebuilt and redeployed. var TotalLanes = 31; @@ -3998,88 +3842,88 @@ var NoLane = var SyncLane = /* */ 1; -var SyncBatchedLane = - /* */ - 2; -var InputDiscreteHydrationLane = - /* */ - 4; -var InputDiscreteLane = - /* */ - 8; var InputContinuousHydrationLane = /* */ - 16; + 2; var InputContinuousLane = /* */ - 32; + 4; var DefaultHydrationLane = /* */ - 64; + 8; var DefaultLane = /* */ - 128; + 16; var TransitionHydrationLane = /* */ - 256; + 32; var TransitionLanes = /* */ - 8388096; + 4194240; var TransitionLane1 = /* */ - 512; + 64; var TransitionLane2 = /* */ - 1024; + 128; var TransitionLane3 = /* */ - 2048; + 256; var TransitionLane4 = /* */ - 4096; + 512; var TransitionLane5 = /* */ - 8192; + 1024; var TransitionLane6 = /* */ - 16384; + 2048; var TransitionLane7 = /* */ - 32768; + 4096; var TransitionLane8 = /* */ - 65536; + 8192; var TransitionLane9 = /* */ - 131072; + 16384; var TransitionLane10 = /* */ - 262144; + 32768; var TransitionLane11 = /* */ - 524288; + 65536; var TransitionLane12 = /* */ - 1048576; + 131072; var TransitionLane13 = /* */ - 2097152; + 262144; var TransitionLane14 = /* */ - 4194304; + 524288; +var TransitionLane15 = + /* */ + 1048576; +var TransitionLane16 = + /* */ + 2097152; var RetryLanes = /* */ - 125829120; + 130023424; var RetryLane1 = /* */ - 8388608; + 4194304; var RetryLane2 = /* */ - 16777216; + 8388608; var RetryLane3 = /* */ - 33554432; + 16777216; var RetryLane4 = + /* */ + 33554432; +var RetryLane5 = /* */ 67108864; var SomeRetryLane = RetryLane1; @@ -4093,61 +3937,33 @@ var IdleHydrationLane = /* */ 268435456; var IdleLane = - /* */ + /* */ 536870912; var OffscreenLane = /* */ 1073741824; // This function is used for the experimental scheduling profiler (react-devtools-scheduling-profiler) var NoTimestamp = -1; -var currentUpdateLanePriority = NoLanePriority; var nextTransitionLane = TransitionLane1; var nextRetryLane = RetryLane1; -function getCurrentUpdateLanePriority() { - return currentUpdateLanePriority; -} -function setCurrentUpdateLanePriority(newLanePriority) { - currentUpdateLanePriority = newLanePriority; -} // "Registers" used to "return" multiple values -// Used by getHighestPriorityLanes and getNextLanes: - -var return_highestLanePriority = DefaultLanePriority; function getHighestPriorityLanes(lanes) { switch (getHighestPriorityLane(lanes)) { case SyncLane: - return_highestLanePriority = SyncLanePriority; return SyncLane; - case SyncBatchedLane: - return_highestLanePriority = SyncBatchedLanePriority; - return SyncBatchedLane; - - case InputDiscreteHydrationLane: - return_highestLanePriority = InputDiscreteHydrationLanePriority; - return InputDiscreteHydrationLane; - - case InputDiscreteLane: - return_highestLanePriority = InputDiscreteLanePriority; - return InputDiscreteLane; - case InputContinuousHydrationLane: - return_highestLanePriority = InputContinuousHydrationLanePriority; return InputContinuousHydrationLane; case InputContinuousLane: - return_highestLanePriority = InputContinuousLanePriority; return InputContinuousLane; case DefaultHydrationLane: - return_highestLanePriority = DefaultHydrationLanePriority; return DefaultHydrationLane; case DefaultLane: - return_highestLanePriority = DefaultLanePriority; return DefaultLane; case TransitionHydrationLane: - return_highestLanePriority = TransitionHydrationPriority; return TransitionHydrationLane; case TransitionLane1: @@ -4164,30 +3980,27 @@ function getHighestPriorityLanes(lanes) { case TransitionLane12: case TransitionLane13: case TransitionLane14: - return_highestLanePriority = TransitionPriority; + case TransitionLane15: + case TransitionLane16: return lanes & TransitionLanes; case RetryLane1: case RetryLane2: case RetryLane3: case RetryLane4: - return_highestLanePriority = RetryLanePriority; + case RetryLane5: return lanes & RetryLanes; case SelectiveHydrationLane: - return_highestLanePriority = SelectiveHydrationLanePriority; return SelectiveHydrationLane; case IdleHydrationLane: - return_highestLanePriority = IdleHydrationLanePriority; return IdleHydrationLane; case IdleLane: - return_highestLanePriority = IdleLanePriority; return IdleLane; case OffscreenLane: - return_highestLanePriority = OffscreenLanePriority; return OffscreenLane; default: @@ -4195,96 +4008,46 @@ function getHighestPriorityLanes(lanes) { error("Should have found matching lanes. This is a bug in React."); } // This shouldn't be reachable, but as a fallback, return the entire bitmask. - return_highestLanePriority = DefaultLanePriority; return lanes; } } -function lanePriorityToSchedulerPriority(lanePriority) { - switch (lanePriority) { - case SyncLanePriority: - case SyncBatchedLanePriority: - return ImmediatePriority; - - case InputDiscreteHydrationLanePriority: - case InputDiscreteLanePriority: - case InputContinuousHydrationLanePriority: - case InputContinuousLanePriority: - return UserBlockingPriority; - - case DefaultHydrationLanePriority: - case DefaultLanePriority: - case TransitionHydrationPriority: - case TransitionPriority: - case SelectiveHydrationLanePriority: - case RetryLanePriority: - return NormalPriority; - - case IdleHydrationLanePriority: - case IdleLanePriority: - case OffscreenLanePriority: - return IdlePriority; - - case NoLanePriority: - return NoPriority; - - default: { - throw Error( - "Invalid update priority: " + lanePriority + ". This is a bug in React." - ); - } - } -} function getNextLanes(root, wipLanes) { // Early bailout if there's no pending work left. var pendingLanes = root.pendingLanes; if (pendingLanes === NoLanes) { - return_highestLanePriority = NoLanePriority; return NoLanes; } var nextLanes = NoLanes; - var nextLanePriority = NoLanePriority; - var expiredLanes = root.expiredLanes; var suspendedLanes = root.suspendedLanes; - var pingedLanes = root.pingedLanes; // Check if any work has expired. + var pingedLanes = root.pingedLanes; // Do not work on any idle work until all the non-idle work has finished, + // even if the work is suspended. - if (expiredLanes !== NoLanes) { - // TODO: Should entangle with SyncLane - nextLanes = expiredLanes; - nextLanePriority = return_highestLanePriority = SyncLanePriority; - } else { - // Do not work on any idle work until all the non-idle work has finished, - // even if the work is suspended. - var nonIdlePendingLanes = pendingLanes & NonIdleLanes; + var nonIdlePendingLanes = pendingLanes & NonIdleLanes; - if (nonIdlePendingLanes !== NoLanes) { - var nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes; + if (nonIdlePendingLanes !== NoLanes) { + var nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes; - if (nonIdleUnblockedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes); - nextLanePriority = return_highestLanePriority; - } else { - var nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes; + if (nonIdleUnblockedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes); + } else { + var nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes; - if (nonIdlePingedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(nonIdlePingedLanes); - nextLanePriority = return_highestLanePriority; - } + if (nonIdlePingedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(nonIdlePingedLanes); } - } else { - // The only remaining work is Idle. - var unblockedLanes = pendingLanes & ~suspendedLanes; + } + } else { + // The only remaining work is Idle. + var unblockedLanes = pendingLanes & ~suspendedLanes; - if (unblockedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(unblockedLanes); - nextLanePriority = return_highestLanePriority; - } else { - if (pingedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(pingedLanes); - nextLanePriority = return_highestLanePriority; - } + if (unblockedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(unblockedLanes); + } else { + if (pingedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(pingedLanes); } } } @@ -4303,20 +4066,19 @@ function getNextLanes(root, wipLanes) { // bother waiting until the root is complete. (wipLanes & suspendedLanes) === NoLanes ) { - getHighestPriorityLanes(wipLanes); - var wipLanePriority = return_highestLanePriority; + var nextLane = getHighestPriorityLane(nextLanes); + var wipLane = getHighestPriorityLane(wipLanes); if ( - nextLanePriority <= wipLanePriority || // Default priority updates should not interrupt transition updates. The + // Tests whether the next lane is equal or lower priority than the wip + // one. This works because the bits decrease in priority as you go left. + nextLane >= wipLane || // Default priority updates should not interrupt transition updates. The // only difference between default updates and transition updates is that // default updates do not support refresh transitions. - (nextLanePriority === DefaultLanePriority && - wipLanePriority === TransitionPriority) + (nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes) ) { // Keep working on the existing in-progress tree. Do not interrupt. return wipLanes; - } else { - return_highestLanePriority = nextLanePriority; } } // Check for entangled lanes and add them to the batch. // @@ -4377,32 +4139,60 @@ function getMostRecentEventTime(root, lanes) { } function computeExpirationTime(lane, currentTime) { - // TODO: Expiration heuristic is constant per lane, so could use a map. - getHighestPriorityLanes(lane); - var priority = return_highestLanePriority; + switch (lane) { + case SyncLane: + case InputContinuousHydrationLane: + case InputContinuousLane: + // User interactions should expire slightly more quickly. + // + // NOTE: This is set to the corresponding constant as in Scheduler.js. + // When we made it larger, a product metric in www regressed, suggesting + // there's a user interaction that's being starved by a series of + // synchronous updates. If that theory is correct, the proper solution is + // to fix the starvation. However, this scenario supports the idea that + // expiration times are an important safeguard when starvation + // does happen. + return currentTime + 250; - if (priority >= InputContinuousLanePriority) { - // User interactions should expire slightly more quickly. - // - // NOTE: This is set to the corresponding constant as in Scheduler.js. When - // we made it larger, a product metric in www regressed, suggesting there's - // a user interaction that's being starved by a series of synchronous - // updates. If that theory is correct, the proper solution is to fix the - // starvation. However, this scenario supports the idea that expiration - // times are an important safeguard when starvation does happen. - // - // Also note that, in the case of user input specifically, this will soon no - // longer be an issue because we plan to make user input synchronous by - // default (until you enter `startTransition`, of course.) - // - // If weren't planning to make these updates synchronous soon anyway, I - // would probably make this number a configurable parameter. - return currentTime + 250; - } else if (priority >= TransitionPriority) { - return currentTime + 5000; - } else { - // Anything idle priority or lower should never expire. - return NoTimestamp; + case DefaultHydrationLane: + case DefaultLane: + case TransitionHydrationLane: + case TransitionLane1: + case TransitionLane2: + case TransitionLane3: + case TransitionLane4: + case TransitionLane5: + case TransitionLane6: + case TransitionLane7: + case TransitionLane8: + case TransitionLane9: + case TransitionLane10: + case TransitionLane11: + case TransitionLane12: + case TransitionLane13: + case TransitionLane14: + case TransitionLane15: + case TransitionLane16: + case RetryLane1: + case RetryLane2: + case RetryLane3: + case RetryLane4: + case RetryLane5: + return currentTime + 5000; + + case SelectiveHydrationLane: + case IdleHydrationLane: + case IdleLane: + case OffscreenLane: + // Anything idle priority or lower should never expire. + return NoTimestamp; + + default: + { + error("Should have found matching lanes. This is a bug in React."); + } + + return NoTimestamp; } } @@ -4418,6 +4208,7 @@ function markStarvedLanesAsExpired(root, currentTime) { // it as expired to force it to finish. var lanes = pendingLanes; + var expiredLanes = 0; while (lanes > 0) { var index = pickArbitraryLaneIndex(lanes); @@ -4437,11 +4228,15 @@ function markStarvedLanesAsExpired(root, currentTime) { } } else if (expirationTime <= currentTime) { // This lane expired - root.expiredLanes |= lane; + expiredLanes |= lane; } lanes &= ~lane; } + + if (expiredLanes !== 0) { + markRootExpired(root, expiredLanes); + } } // This returns the highest priority pending lanes regardless of whether they function getLanesToRetrySynchronouslyOnError(root) { var everythingButOffscreen = root.pendingLanes & ~OffscreenLane; @@ -4456,9 +4251,6 @@ function getLanesToRetrySynchronouslyOnError(root) { return NoLanes; } -function returnNextLanesPriority() { - return return_highestLanePriority; -} function includesNonIdleWork(lanes) { return (lanes & NonIdleLanes) !== NoLanes; } @@ -4470,44 +4262,6 @@ function includesOnlyTransitions(lanes) { } function isTransitionLane(lane) { return (lane & TransitionLanes) !== 0; -} // To ensure consistency across multiple updates in the same event, this should -// be a pure function, so that it always returns the same lane for given inputs. - -function findUpdateLane(lanePriority) { - switch (lanePriority) { - case NoLanePriority: - break; - - case SyncLanePriority: - return SyncLane; - - case SyncBatchedLanePriority: - return SyncBatchedLane; - - case InputDiscreteLanePriority: - return SyncLane; - - case InputContinuousLanePriority: - return InputContinuousLane; - - case DefaultLanePriority: - return DefaultLane; - - case TransitionPriority: // Should be handled by findTransitionLane instead - - case RetryLanePriority: - // Should be handled by findRetryLane instead - break; - - case IdleLanePriority: - return IdleLane; - } - - { - throw Error( - "Invalid update priority: " + lanePriority + ". This is a bug in React." - ); - } } function claimNextTransitionLane() { // Cycle through the lanes, assigning each new transition to the next lane. @@ -4532,11 +4286,9 @@ function claimNextRetryLane() { return lane; } - function getHighestPriorityLane(lanes) { return lanes & -lanes; } - function pickArbitraryLane(lanes) { // This wrapper function gets inlined. Only exists so to communicate that it // doesn't matter which bit is selected; you can pick any bit without @@ -4573,9 +4325,6 @@ function intersectLanes(a, b) { function laneToLanes(lane) { return lane; } -function higherLanePriority(a, b) { - return a !== NoLanePriority && a > b ? a : b; -} function createLaneMap(initial) { // Intentionally pushing one by one. // https://v8.dev/blog/elements-kinds#avoid-creating-holes @@ -4630,7 +4379,16 @@ function markRootPinged(root, pingedLanes, eventTime) { root.pingedLanes |= root.suspendedLanes & pingedLanes; } function markRootExpired(root, expiredLanes) { - root.expiredLanes |= expiredLanes & root.pendingLanes; + var entanglements = root.entanglements; + var SyncLaneIndex = 0; + entanglements[SyncLaneIndex] |= expiredLanes; + root.entangledLanes |= SyncLane; + root.pendingLanes |= SyncLane; +} +function areLanesExpired(root, lanes) { + var SyncLaneIndex = 0; + var entanglements = root.entanglements; + return (entanglements[SyncLaneIndex] & lanes) !== NoLanes; } function markRootMutableRead(root, updateLane) { root.mutableReadLanes |= updateLane & root.pendingLanes; @@ -4641,7 +4399,6 @@ function markRootFinished(root, remainingLanes) { root.suspendedLanes = 0; root.pingedLanes = 0; - root.expiredLanes &= remainingLanes; root.mutableReadLanes &= remainingLanes; root.entangledLanes &= remainingLanes; @@ -4706,25 +4463,40 @@ function clz32Fallback(lanes) { return (31 - ((log(lanes) / LN2) | 0)) | 0; } -// Intentionally not named imports because Rollup would use dynamic dispatch for -var Scheduler_now$1 = Scheduler.unstable_now; +var DiscreteEventPriority = SyncLane; +var ContinuousEventPriority = InputContinuousLane; +var DefaultEventPriority = DefaultLane; +var IdleEventPriority = IdleLane; +var currentUpdatePriority = NoLane; +function getCurrentUpdatePriority() { + return currentUpdatePriority; +} +function setCurrentUpdatePriority(newPriority) { + currentUpdatePriority = newPriority; +} +function higherEventPriority(a, b) { + return a !== 0 && a < b ? a : b; +} +function isHigherEventPriority(a, b) { + return a !== 0 && a < b; +} +function lanesToEventPriority(lanes) { + var lane = getHighestPriorityLane(lanes); -{ - // Provide explicit error message when production+profiling bundle of e.g. - // react-dom is used with production (non-profiling) bundle of - // scheduler/tracing - if ( - !( - tracing.__interactionsRef != null && - tracing.__interactionsRef.current != null - ) - ) { - throw Error( - "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at https://reactjs.org/link/profiling" - ); + if (!isHigherEventPriority(DiscreteEventPriority, lane)) { + return DiscreteEventPriority; + } + + if (!isHigherEventPriority(ContinuousEventPriority, lane)) { + return ContinuousEventPriority; + } + + if (includesNonIdleWork(lane)) { + return DefaultEventPriority; } + + return IdleEventPriority; } -var initialTimeMs$1 = Scheduler_now$1(); // If the initial timestamp is reasonably small, use Scheduler's `now` directly. // can re-export everything from this module. @@ -4754,7 +4526,6 @@ var isSuspenseInstanceFallback = shim$1; var hydrateTextInstance = shim$1; var errorHydratingContainer = shim$1; -var DefaultLanePriority$1 = DefaultLanePriority; // Modules provided by RN: var _nativeFabricUIManage = nativeFabricUIManager, createNode = _nativeFabricUIManage.createNode, cloneNode = _nativeFabricUIManage.cloneNode, @@ -4989,7 +4760,7 @@ function shouldSetTextContent(type, props) { return false; } function getCurrentEventPriority() { - return DefaultLanePriority$1; + return DefaultEventPriority; } // The Fabric renderer is secondary to the existing React Native renderer. var scheduleTimeout = setTimeout; var cancelTimeout = clearTimeout; @@ -5703,6 +5474,33 @@ function findCurrentUnmaskedContext(fiber) { var LegacyRoot = 0; var ConcurrentRoot = 1; +// This module only exists as an ESM wrapper around the external CommonJS +var scheduleCallback = Scheduler.unstable_scheduleCallback; +var cancelCallback = Scheduler.unstable_cancelCallback; +var shouldYield = Scheduler.unstable_shouldYield; +var requestPaint = Scheduler.unstable_requestPaint; +var now = Scheduler.unstable_now; +var ImmediatePriority = Scheduler.unstable_ImmediatePriority; +var UserBlockingPriority = Scheduler.unstable_UserBlockingPriority; +var NormalPriority = Scheduler.unstable_NormalPriority; +var IdlePriority = Scheduler.unstable_IdlePriority; + +{ + // Provide explicit error message when production+profiling bundle of e.g. + // react-dom is used with production (non-profiling) bundle of + // scheduler/tracing + if ( + !( + tracing.__interactionsRef != null && + tracing.__interactionsRef.current != null + ) + ) { + throw Error( + "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at https://reactjs.org/link/profiling" + ); + } +} + var rendererID = null; var injectedHook = null; var hasLoggedError = false; @@ -5765,16 +5563,36 @@ function onScheduleRoot(root, children) { } } } -function onCommitRoot(root, priorityLevel) { +function onCommitRoot(root, eventPriority) { if (injectedHook && typeof injectedHook.onCommitFiberRoot === "function") { try { var didError = (root.current.flags & DidCapture) === DidCapture; if (enableProfilerTimer) { - var schedulerPriority = - priorityLevel === NoLanePriority - ? NormalPriority - : lanePriorityToSchedulerPriority(priorityLevel); + var schedulerPriority; + + switch (eventPriority) { + case DiscreteEventPriority: + schedulerPriority = ImmediatePriority; + break; + + case ContinuousEventPriority: + schedulerPriority = UserBlockingPriority; + break; + + case DefaultEventPriority: + schedulerPriority = NormalPriority; + break; + + case IdleEventPriority: + schedulerPriority = IdlePriority; + break; + + default: + schedulerPriority = NormalPriority; + break; + } + injectedHook.onCommitFiberRoot( rendererID, root, @@ -5811,6 +5629,59 @@ function onCommitUnmount(fiber) { } } +var syncQueue = null; +var isFlushingSyncQueue = false; +function scheduleSyncCallback(callback) { + // Push this callback into an internal queue. We'll flush these either in + // the next tick, or earlier if something calls `flushSyncCallbackQueue`. + if (syncQueue === null) { + syncQueue = [callback]; + } else { + // Push onto existing queue. Don't need to schedule a callback because + // we already scheduled one when we created the queue. + syncQueue.push(callback); + } +} +function flushSyncCallbackQueue() { + if (!isFlushingSyncQueue && syncQueue !== null) { + // Prevent re-entrancy. + isFlushingSyncQueue = true; + var i = 0; + var previousUpdatePriority = getCurrentUpdatePriority(); + + try { + var isSync = true; + var queue = syncQueue; // TODO: Is this necessary anymore? The only user code that runs in this + // queue is in the render or commit phases. + + setCurrentUpdatePriority(DiscreteEventPriority); + + for (; i < queue.length; i++) { + var callback = queue[i]; + + do { + callback = callback(isSync); + } while (callback !== null); + } + + syncQueue = null; + } catch (error) { + // If something throws, leave the remaining callbacks on the queue. + if (syncQueue !== null) { + syncQueue = syncQueue.slice(i + 1); + } // Resume flushing in the next tick + + scheduleCallback(ImmediatePriority, flushSyncCallbackQueue); + throw error; + } finally { + setCurrentUpdatePriority(previousUpdatePriority); + isFlushingSyncQueue = false; + } + } + + return null; +} + var NoFlags$1 = /* */ 0; // Represents whether effect should fire. @@ -5828,10 +5699,10 @@ var Passive$1 = // TODO: this is special because it gets imported during build. // -// TODO: 17.0.2 has not been released to NPM; +// TODO: 17.0.3 has not been released to NPM; // It exists as a placeholder so that DevTools can support work tag changes between releases. -// When we next publish a release (either 17.0.2 or 17.1.0), update the matching TODO in backend/renderer.js -var ReactVersion = "17.0.2"; +// When we next publish a release (either 17.0.3 or 17.1.0), update the matching TODO in backend/renderer.js +var ReactVersion = "17.0.3"; var NoMode = /* */ @@ -11249,15 +11120,11 @@ function rerenderDeferredValue(value) { } function startTransition(setPending, callback) { - var previousLanePriority = getCurrentUpdateLanePriority(); - setCurrentUpdateLanePriority( - higherLanePriority(previousLanePriority, InputContinuousLanePriority) + var previousPriority = getCurrentUpdatePriority(); + setCurrentUpdatePriority( + higherEventPriority(previousPriority, ContinuousEventPriority) ); - setPending(true); // TODO: Can remove this. Was only necessary because we used to give - // different behavior to transitions without a config object. Now they are - // all treated the same. - - setCurrentUpdateLanePriority(DefaultLanePriority); + setPending(true); var prevTransition = ReactCurrentBatchConfig$1.transition; ReactCurrentBatchConfig$1.transition = 1; @@ -11265,7 +11132,7 @@ function startTransition(setPending, callback) { setPending(false); callback(); } finally { - setCurrentUpdateLanePriority(previousLanePriority); + setCurrentUpdatePriority(previousPriority); ReactCurrentBatchConfig$1.transition = prevTransition; } } @@ -17439,12 +17306,7 @@ function commitDetachRef(current) { // deletion, so don't let them throw. Host-originating errors should // interrupt deletion, so it's okay -function commitUnmount( - finishedRoot, - current, - nearestMountedAncestor, - renderPriorityLevel -) { +function commitUnmount(finishedRoot, current, nearestMountedAncestor) { onCommitUnmount(current); switch (current.tag) { @@ -17523,12 +17385,7 @@ function commitUnmount( } } -function commitNestedUnmounts( - finishedRoot, - root, - nearestMountedAncestor, - renderPriorityLevel -) { +function commitNestedUnmounts(finishedRoot, root, nearestMountedAncestor) { // While we're inside a removed host node we don't want to call // removeChild on the inner nodes because they're removed by the top // call anyway. We also want to call componentWillUnmount on all @@ -17584,25 +17441,39 @@ function detachFiberMutation(fiber) { // Don't reset the alternate yet, either. We need that so we can detach the // alternate's fields in the passive phase. Clearing the return pointer is // sufficient for findDOMNode semantics. + var alternate = fiber.alternate; + + if (alternate !== null) { + alternate.return = null; + } + fiber.return = null; } function detachFiberAfterEffects(fiber) { - // Null out fields to improve GC for references that may be lingering (e.g. DevTools). - // Note that we already cleared the return pointer in detachFiberMutation(). - fiber.alternate = null; - fiber.child = null; - fiber.deletions = null; - fiber.dependencies = null; - fiber.memoizedProps = null; - fiber.memoizedState = null; - fiber.pendingProps = null; - fiber.sibling = null; - fiber.stateNode = null; - fiber.updateQueue = null; + var alternate = fiber.alternate; + + if (alternate !== null) { + fiber.alternate = null; + detachFiberAfterEffects(alternate); + } // Note: Defensively using negation instead of < in case + // `deletedTreeCleanUpLevel` is undefined. { - fiber._debugOwner = null; + // This is the default branch (level 0). + fiber.child = null; + fiber.deletions = null; + fiber.dependencies = null; + fiber.memoizedProps = null; + fiber.memoizedState = null; + fiber.pendingProps = null; + fiber.sibling = null; + fiber.stateNode = null; + fiber.updateQueue = null; + + { + fiber._debugOwner = null; + } } } @@ -17636,23 +17507,13 @@ function commitContainer(finishedWork) { } } -function commitDeletion( - finishedRoot, - current, - nearestMountedAncestor, - renderPriorityLevel -) { +function commitDeletion(finishedRoot, current, nearestMountedAncestor) { { // Detach refs and call componentWillUnmount() on the whole subtree. commitNestedUnmounts(finishedRoot, current, nearestMountedAncestor); } - var alternate = current.alternate; detachFiberMutation(current); - - if (alternate !== null) { - detachFiberMutation(alternate); - } } function commitWork(current, finishedWork) { @@ -17763,12 +17624,12 @@ function isSuspenseBoundaryBeingHidden(current, finishedWork) { return false; } -function commitMutationEffects(root, renderPriorityLevel, firstChild) { +function commitMutationEffects(root, firstChild) { nextEffect = firstChild; - commitMutationEffects_begin(root, renderPriorityLevel); + commitMutationEffects_begin(root); } -function commitMutationEffects_begin(root, renderPriorityLevel) { +function commitMutationEffects_begin(root) { while (nextEffect !== null) { var fiber = nextEffect; // TODO: Should wrap this in flags check, too, as optimization @@ -17785,8 +17646,7 @@ function commitMutationEffects_begin(root, renderPriorityLevel) { null, root, childToDelete, - fiber, - renderPriorityLevel + fiber ); if (hasCaughtError()) { @@ -17803,12 +17663,12 @@ function commitMutationEffects_begin(root, renderPriorityLevel) { ensureCorrectReturnPointer(child, fiber); nextEffect = child; } else { - commitMutationEffects_complete(root, renderPriorityLevel); + commitMutationEffects_complete(root); } } } -function commitMutationEffects_complete(root, renderPriorityLevel) { +function commitMutationEffects_complete(root) { while (nextEffect !== null) { var fiber = nextEffect; @@ -17819,8 +17679,7 @@ function commitMutationEffects_complete(root, renderPriorityLevel) { commitMutationEffectsOnFiber, null, fiber, - root, - renderPriorityLevel + root ); if (hasCaughtError()) { @@ -17843,7 +17702,7 @@ function commitMutationEffects_complete(root, renderPriorityLevel) { } } -function commitMutationEffectsOnFiber(finishedWork, root, renderPriorityLevel) { +function commitMutationEffectsOnFiber(finishedWork, root) { var flags = finishedWork.flags; if (flags & Ref) { @@ -18058,13 +17917,35 @@ function commitPassiveUnmountEffects_begin() { commitPassiveUnmountEffectsInsideOfDeletedTree_begin( fiberToDelete, fiber - ); // Now that passive effects have been processed, it's safe to detach lingering pointers. - - var alternate = fiberToDelete.alternate; - detachFiberAfterEffects(fiberToDelete); + ); + } - if (alternate !== null) { - detachFiberAfterEffects(alternate); + { + // A fiber was deleted from this parent fiber, but it's still part of + // the previous (alternate) parent fiber's list of children. Because + // children are a linked list, an earlier sibling that's still alive + // will be connected to the deleted fiber via its `alternate`: + // + // live fiber + // --alternate--> previous live fiber + // --sibling--> deleted fiber + // + // We can't disconnect `alternate` on nodes that haven't been deleted + // yet, but we can disconnect the `sibling` and `child` pointers. + var previousFiber = fiber.alternate; + + if (previousFiber !== null) { + var detachedChild = previousFiber.child; + + if (detachedChild !== null) { + previousFiber.child = null; + + do { + var detachedSibling = detachedChild.sibling; + detachedChild.sibling = null; + detachedChild = detachedSibling; + } while (detachedChild !== null); + } } } @@ -18132,7 +18013,8 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin( setCurrentFiber(fiber); commitPassiveUnmountInsideDeletedTreeOnFiber(fiber, nearestMountedAncestor); resetCurrentFiber(); - var child = fiber.child; // TODO: Only traverse subtree if it has a PassiveStatic flag + var child = fiber.child; // TODO: Only traverse subtree if it has a PassiveStatic flag. (But, if we + // do this, still need to handle `deletedTreeCleanUpLevel` correctly.) if (child !== null) { ensureCorrectReturnPointer(child, fiber); @@ -18150,21 +18032,26 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_complete( ) { while (nextEffect !== null) { var fiber = nextEffect; + var sibling = fiber.sibling; + var returnFiber = fiber.return; - if (fiber === deletedSubtreeRoot) { - nextEffect = null; - return; + { + // This is the default branch (level 0). We do not recursively clear all + // the fiber fields. Only the root of the deleted subtree. + if (fiber === deletedSubtreeRoot) { + detachFiberAfterEffects(fiber); + nextEffect = null; + return; + } } - var sibling = fiber.sibling; - if (sibling !== null) { - ensureCorrectReturnPointer(sibling, fiber.return); + ensureCorrectReturnPointer(sibling, returnFiber); nextEffect = sibling; return; } - nextEffect = fiber.return; + nextEffect = returnFiber; } } @@ -18302,7 +18189,6 @@ var firstUncaughtError = null; var legacyErrorBoundariesThatAlreadyFailed = null; // Only used when enableProfilerNestedUpdateScheduledHook is true; var rootDoesHavePassiveEffects = false; var rootWithPendingPassiveEffects = null; -var pendingPassiveEffectsRenderPriority = NoLanePriority; var pendingPassiveEffectsLanes = NoLanes; var NESTED_UPDATE_LIMIT = 50; @@ -18347,32 +18233,44 @@ function requestUpdateLane(fiber) { if ((mode & ConcurrentMode) === NoMode) { return SyncLane; - } else if ((mode & ConcurrentMode) === NoMode) { - return getCurrentUpdateLanePriority() === SyncLanePriority - ? SyncLane - : SyncBatchedLane; - } // The algorithm for assigning an update to a lane should be stable for all + } var isTransition = requestCurrentTransition() !== NoTransition; if (isTransition) { + // The algorithm for assigning an update to a lane should be stable for all + // updates at the same priority within the same event. To do this, the + // inputs to the algorithm must be the same. + // + // The trick we use is to cache the first of each of these inputs within an + // 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) { + // All transitions within the same event are assigned the same lane. currentEventTransitionLane = claimNextTransitionLane(); } return currentEventTransitionLane; } // Updates originating inside certain React methods, like flushSync, have // their priority set by tracking it with a context variable. + // + // The opaque type returned by the host config is internally a lane, so we can + // use that directly. + // TODO: Move this type conversion to the event priority module. - var updateLanePriority = getCurrentUpdateLanePriority(); + var updateLane = getCurrentUpdatePriority(); - if (updateLanePriority !== NoLanePriority) { - return findUpdateLane(updateLanePriority); + if (updateLane !== NoLane) { + return updateLane; } // This update originated outside React. Ask the host environement for an // appropriate priority, based on the type of event. + // + // The opaque type returned by the host config is internally a lane, so we can + // use that directly. + // TODO: Move this type conversion to the event priority module. - var eventLanePriority = getCurrentEventPriority(); - return findUpdateLane(eventLanePriority); + var eventLane = getCurrentEventPriority(); + return eventLane; } function requestRetryLane(fiber) { @@ -18384,11 +18282,7 @@ function requestRetryLane(fiber) { if ((mode & ConcurrentMode) === NoMode) { return SyncLane; - } else if ((mode & ConcurrentMode) === NoMode) { - return getCurrentUpdateLanePriority() === SyncLanePriority - ? SyncLane - : SyncBatchedLane; - } // See `requestUpdateLane` for explanation of `currentEventWipLanes` + } return claimNextRetryLane(); } @@ -18544,9 +18438,7 @@ function ensureRootIsScheduled(root, currentTime) { var nextLanes = getNextLanes( root, root === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes - ); // This returns the priority level computed during the `getNextLanes` call. - - var newCallbackPriority = returnNextLanesPriority(); + ); if (nextLanes === NoLanes) { // Special case: There's nothing to work on. @@ -18555,9 +18447,11 @@ function ensureRootIsScheduled(root, currentTime) { } root.callbackNode = null; - root.callbackPriority = NoLanePriority; + root.callbackPriority = NoLane; return; - } // Check if there's an existing task. We may be able to reuse it. + } // We use the highest priority lane to represent the priority of the callback. + + var newCallbackPriority = getHighestPriorityLane(nextLanes); // Check if there's an existing task. We may be able to reuse it. var existingCallbackPriority = root.callbackPriority; @@ -18568,8 +18462,7 @@ function ensureRootIsScheduled(root, currentTime) { // TODO: Temporary until we confirm this warning is not fired. if ( existingCallbackNode == null && - existingCallbackPriority !== InputDiscreteLanePriority && - existingCallbackPriority !== SyncLanePriority + existingCallbackPriority !== SyncLane ) { error( "Expected scheduled callback to exist. This error is likely caused by a bug in React. Please file an issue." @@ -18587,7 +18480,7 @@ function ensureRootIsScheduled(root, currentTime) { var newCallbackNode; - if (newCallbackPriority === SyncLanePriority) { + if (newCallbackPriority === SyncLane) { // Special case: Sync React callbacks are scheduled on a special // internal queue scheduleSyncCallback(performSyncWorkOnRoot.bind(null, root)); @@ -18598,15 +18491,31 @@ function ensureRootIsScheduled(root, currentTime) { } newCallbackNode = null; - } else if (newCallbackPriority === SyncBatchedLanePriority) { - newCallbackNode = scheduleCallback( - ImmediatePriority, - performSyncWorkOnRoot.bind(null, root) - ); } else { - var schedulerPriorityLevel = lanePriorityToSchedulerPriority( - newCallbackPriority - ); + var schedulerPriorityLevel; + + switch (lanesToEventPriority(nextLanes)) { + case DiscreteEventPriority: + schedulerPriorityLevel = ImmediatePriority; + break; + + case ContinuousEventPriority: + schedulerPriorityLevel = UserBlockingPriority; + break; + + case DefaultEventPriority: + schedulerPriorityLevel = NormalPriority; + break; + + case IdleEventPriority: + schedulerPriorityLevel = IdlePriority; + break; + + default: + schedulerPriorityLevel = NormalPriority; + break; + } + newCallbackNode = scheduleCallback( schedulerPriorityLevel, performConcurrentWorkOnRoot.bind(null, root) @@ -18858,15 +18767,14 @@ function performSyncWorkOnRoot(root) { if ( root === workInProgressRoot && - includesSomeLane(root.expiredLanes, workInProgressRootRenderLanes) + areLanesExpired(root, workInProgressRootRenderLanes) ) { // There's a partial tree, and at least one of its lanes has expired. Finish // rendering it before rendering the rest of the expired work. lanes = workInProgressRootRenderLanes; exitStatus = renderRootSync(root, lanes); } else { - lanes = getNextLanes(root, NoLanes); // Because we don't cancel synchronous tasks, sometimes more than one - + lanes = getNextLanes(root, NoLanes); exitStatus = renderRootSync(root, lanes); } @@ -18911,7 +18819,7 @@ function performSyncWorkOnRoot(root) { ensureRootIsScheduled(root, now()); return null; -} +} // TODO: Do we still need this API? I think we can delete it. Was only used function batchedUpdates$1(fn, a) { var prevExecutionContext = executionContext; executionContext |= BatchedContext; @@ -18930,24 +18838,11 @@ function batchedUpdates$1(fn, a) { } function flushSync(fn, a) { var prevExecutionContext = executionContext; - - if ((prevExecutionContext & (RenderContext | CommitContext)) !== NoContext) { - { - error( - "flushSync was called from inside a lifecycle method. React cannot " + - "flush when React is already rendering. Consider moving this call to " + - "a scheduler task or micro task." - ); - } - - return fn(a); - } - executionContext |= BatchedContext; - var previousLanePriority = getCurrentUpdateLanePriority(); + var previousPriority = getCurrentUpdatePriority(); try { - setCurrentUpdateLanePriority(SyncLanePriority); + setCurrentUpdatePriority(DiscreteEventPriority); if (fn) { return fn(a); @@ -18955,12 +18850,22 @@ function flushSync(fn, a) { return undefined; } } finally { - setCurrentUpdateLanePriority(previousLanePriority); + setCurrentUpdatePriority(previousPriority); executionContext = prevExecutionContext; // Flush the immediate callbacks that were scheduled during this batch. // Note that this will happen even if batchedUpdates is higher up // the stack. - flushSyncCallbackQueue(); + if ((executionContext & (RenderContext | CommitContext)) === NoContext) { + flushSyncCallbackQueue(); + } else { + { + error( + "flushSync was called from inside a lifecycle method. React cannot " + + "flush when React is already rendering. Consider moving this call to " + + "a scheduler task or micro task." + ); + } + } } } function pushRenderLanes(fiber, lanes) { @@ -19388,13 +19293,15 @@ function completeUnitOfWork(unitOfWork) { } function commitRoot(root) { - var previousUpdateLanePriority = getCurrentUpdateLanePriority(); + // TODO: This no longer makes any sense. We already wrap the mutation and + // layout phases. Should be able to remove. + var previousUpdateLanePriority = getCurrentUpdatePriority(); try { - setCurrentUpdateLanePriority(SyncLanePriority); + setCurrentUpdatePriority(DiscreteEventPriority); commitRootImpl(root, previousUpdateLanePriority); } finally { - setCurrentUpdateLanePriority(previousUpdateLanePriority); + setCurrentUpdatePriority(previousUpdateLanePriority); } return null; @@ -19435,7 +19342,7 @@ function commitRootImpl(root, renderPriorityLevel) { // So we can clear these now to allow a new callback to be scheduled. root.callbackNode = null; - root.callbackPriority = NoLanePriority; // Update the first and last pending times on this root. The new first + root.callbackPriority = NoLane; // Update the first and last pending times on this root. The new first // pending time is whatever is left on the root fiber. var remainingLanes = mergeLanes(finishedWork.lanes, finishedWork.childLanes); @@ -19479,8 +19386,8 @@ function commitRootImpl(root, renderPriorityLevel) { NoFlags; if (subtreeHasEffects || rootHasEffect) { - var previousLanePriority = getCurrentUpdateLanePriority(); - setCurrentUpdateLanePriority(SyncLanePriority); + var previousPriority = getCurrentUpdatePriority(); + setCurrentUpdatePriority(DiscreteEventPriority); var prevExecutionContext = executionContext; executionContext |= CommitContext; var prevInteractions = pushInteractions(root); // Reset this to null before calling lifecycles @@ -19503,7 +19410,7 @@ function commitRootImpl(root, renderPriorityLevel) { recordCommitTime(); } - commitMutationEffects(root, renderPriorityLevel, finishedWork); + commitMutationEffects(root, finishedWork); resetAfterCommit(root.containerInfo); // The work-in-progress tree is now the current tree. This must come after // the mutation phase, so that the previous tree is still current during @@ -19521,12 +19428,9 @@ function commitRootImpl(root, renderPriorityLevel) { popInteractions(prevInteractions); } - executionContext = prevExecutionContext; + executionContext = prevExecutionContext; // Reset the priority to the previous non-sync value. - if (previousLanePriority != null) { - // Reset the priority to the previous non-sync value. - setCurrentUpdateLanePriority(previousLanePriority); - } + setCurrentUpdatePriority(previousPriority); } else { // No effects. root.current = finishedWork; // Measure these anyway so the flamegraph explicitly shows that there were @@ -19546,10 +19450,6 @@ function commitRootImpl(root, renderPriorityLevel) { rootDoesHavePassiveEffects = false; rootWithPendingPassiveEffects = root; pendingPassiveEffectsLanes = lanes; - pendingPassiveEffectsRenderPriority = - renderPriorityLevel === NoLanePriority - ? DefaultLanePriority - : renderPriorityLevel; } // Read this again, since an effect might have updated it remainingLanes = root.pendingLanes; // Check if there's remaining work on this root @@ -19627,19 +19527,18 @@ function commitRootImpl(root, renderPriorityLevel) { function flushPassiveEffects() { // Returns whether passive effects were flushed. - if (pendingPassiveEffectsRenderPriority !== NoLanePriority) { - var priorityLevel = - pendingPassiveEffectsRenderPriority > DefaultLanePriority - ? DefaultLanePriority - : pendingPassiveEffectsRenderPriority; - pendingPassiveEffectsRenderPriority = NoLanePriority; - var previousLanePriority = getCurrentUpdateLanePriority(); + if (pendingPassiveEffectsLanes !== NoLanes) { + var priority = higherEventPriority( + DefaultEventPriority, + lanesToEventPriority(pendingPassiveEffectsLanes) + ); + var previousPriority = getCurrentUpdatePriority(); try { - setCurrentUpdateLanePriority(priorityLevel); + setCurrentUpdatePriority(priority); return flushPassiveEffectsImpl(); } finally { - setCurrentUpdateLanePriority(previousLanePriority); + setCurrentUpdatePriority(previousPriority); } } @@ -21450,13 +21349,12 @@ function FiberRootNode(containerInfo, tag, hydrate) { this.pendingContext = null; this.hydrate = hydrate; this.callbackNode = null; - this.callbackPriority = NoLanePriority; + this.callbackPriority = NoLane; this.eventTimes = createLaneMap(NoLanes); this.expirationTimes = createLaneMap(NoTimestamp); this.pendingLanes = NoLanes; this.suspendedLanes = NoLanes; this.pingedLanes = NoLanes; - this.expiredLanes = NoLanes; this.mutableReadLanes = NoLanes; this.finishedLanes = NoLanes; this.entangledLanes = NoLanes; @@ -22167,23 +22065,25 @@ var getInspectorDataForViewAtPoint; } closestInstance = - internalInstanceHandle.stateNode.canonical._internalInstanceHandle; + internalInstanceHandle.stateNode.canonical._internalInstanceHandle; // Note: this is deprecated and we want to remove it ASAP. Keeping it here for React DevTools compatibility for now. + + var nativeViewTag = + internalInstanceHandle.stateNode.canonical._nativeTag; nativeFabricUIManager.measure( internalInstanceHandle.stateNode.node, function(x, y, width, height, pageX, pageY) { + var inspectorData = getInspectorDataForInstance(closestInstance); callback( - Object.assign( - { - pointerY: locationY, - frame: { - left: pageX, - top: pageY, - width: width, - height: height - } + Object.assign({}, inspectorData, { + pointerY: locationY, + frame: { + left: pageX, + top: pageY, + width: width, + height: height }, - getInspectorDataForInstance(closestInstance) - ) + touchedViewTag: nativeViewTag + }) ); } ); diff --git a/Libraries/Renderer/implementations/ReactFabric-prod.fb.js b/Libraries/Renderer/implementations/ReactFabric-prod.fb.js index 3744cd736a7031..9f53caacdd48fa 100644 --- a/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +++ b/Libraries/Renderer/implementations/ReactFabric-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<038994eb7caacd1c316dec811d26d9ed>> + * @generated SignedSource<> */ "use strict"; @@ -929,7 +929,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_212 = { +var injectedNamesToPlugins$jscomp$inline_214 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -964,34 +964,34 @@ var injectedNamesToPlugins$jscomp$inline_212 = { } } }, - isOrderingDirty$jscomp$inline_213 = !1, - pluginName$jscomp$inline_214; -for (pluginName$jscomp$inline_214 in injectedNamesToPlugins$jscomp$inline_212) + isOrderingDirty$jscomp$inline_215 = !1, + pluginName$jscomp$inline_216; +for (pluginName$jscomp$inline_216 in injectedNamesToPlugins$jscomp$inline_214) if ( - injectedNamesToPlugins$jscomp$inline_212.hasOwnProperty( - pluginName$jscomp$inline_214 + injectedNamesToPlugins$jscomp$inline_214.hasOwnProperty( + pluginName$jscomp$inline_216 ) ) { - var pluginModule$jscomp$inline_215 = - injectedNamesToPlugins$jscomp$inline_212[pluginName$jscomp$inline_214]; + var pluginModule$jscomp$inline_217 = + injectedNamesToPlugins$jscomp$inline_214[pluginName$jscomp$inline_216]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_214) || - namesToPlugins[pluginName$jscomp$inline_214] !== - pluginModule$jscomp$inline_215 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_216) || + namesToPlugins[pluginName$jscomp$inline_216] !== + pluginModule$jscomp$inline_217 ) { - if (namesToPlugins[pluginName$jscomp$inline_214]) + if (namesToPlugins[pluginName$jscomp$inline_216]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - pluginName$jscomp$inline_214 + + pluginName$jscomp$inline_216 + "`." ); namesToPlugins[ - pluginName$jscomp$inline_214 - ] = pluginModule$jscomp$inline_215; - isOrderingDirty$jscomp$inline_213 = !0; + pluginName$jscomp$inline_216 + ] = pluginModule$jscomp$inline_217; + isOrderingDirty$jscomp$inline_215 = !0; } } -isOrderingDirty$jscomp$inline_213 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_215 && recomputePluginOrdering(); function getInstanceFromInstance(instanceHandle) { return instanceHandle; } @@ -1591,98 +1591,25 @@ function dispatchEvent(target, topLevelType, nativeEvent) { } }); } -var Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback, - Scheduler_cancelCallback = Scheduler.unstable_cancelCallback, - Scheduler_shouldYield = Scheduler.unstable_shouldYield, - Scheduler_requestPaint = Scheduler.unstable_requestPaint, - Scheduler_now = Scheduler.unstable_now, - Scheduler_ImmediatePriority = Scheduler.unstable_ImmediatePriority, - Scheduler_UserBlockingPriority = Scheduler.unstable_UserBlockingPriority, - Scheduler_NormalPriority = Scheduler.unstable_NormalPriority, - Scheduler_LowPriority = Scheduler.unstable_LowPriority, - Scheduler_IdlePriority = Scheduler.unstable_IdlePriority, - requestPaint = - void 0 !== Scheduler_requestPaint ? Scheduler_requestPaint : function() {}, - syncQueue = null, - isFlushingSyncQueue = !1, - initialTimeMs = Scheduler_now(), - now = - 1e4 > initialTimeMs - ? Scheduler_now - : function() { - return Scheduler_now() - initialTimeMs; - }; -function reactPriorityToSchedulerPriority(reactPriorityLevel) { - switch (reactPriorityLevel) { - case 99: - return Scheduler_ImmediatePriority; - case 98: - return Scheduler_UserBlockingPriority; - case 97: - return Scheduler_NormalPriority; - case 96: - return Scheduler_LowPriority; - case 95: - return Scheduler_IdlePriority; - default: - throw Error("Unknown priority level."); - } -} -function scheduleCallback(reactPriorityLevel, callback, options) { - reactPriorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); - return Scheduler_scheduleCallback(reactPriorityLevel, callback, options); -} -function flushSyncCallbackQueue() { - if (!isFlushingSyncQueue && null !== syncQueue) { - isFlushingSyncQueue = !0; - var i = 0, - previousLanePriority = currentUpdateLanePriority; - try { - var queue = syncQueue; - for (currentUpdateLanePriority = 15; i < queue.length; i++) { - var callback = queue[i]; - do callback = callback(!0); - while (null !== callback); - } - syncQueue = null; - } catch (error) { - throw (null !== syncQueue && (syncQueue = syncQueue.slice(i + 1)), - Scheduler_scheduleCallback( - Scheduler_ImmediatePriority, - flushSyncCallbackQueue - ), - error); - } finally { - (currentUpdateLanePriority = previousLanePriority), - (isFlushingSyncQueue = !1); - } - } - return null; -} -var currentUpdateLanePriority = 0, - nextTransitionLane = 512, - nextRetryLane = 8388608, - return_highestLanePriority = 8; +var nextTransitionLane = 64, + nextRetryLane = 4194304; function getHighestPriorityLanes(lanes) { switch (lanes & -lanes) { case 1: - return (return_highestLanePriority = 15), 1; + return 1; case 2: - return (return_highestLanePriority = 14), 2; + return 2; case 4: - return (return_highestLanePriority = 13), 4; + return 4; case 8: - return (return_highestLanePriority = 12), 8; + return 8; case 16: - return (return_highestLanePriority = 11), 16; + return 16; case 32: - return (return_highestLanePriority = 10), 32; + return 32; case 64: - return (return_highestLanePriority = 9), 64; case 128: - return (return_highestLanePriority = 8), 128; case 256: - return (return_highestLanePriority = 7), 256; case 512: case 1024: case 2048: @@ -1696,129 +1623,108 @@ function getHighestPriorityLanes(lanes) { case 524288: case 1048576: case 2097152: + return lanes & 4194240; case 4194304: - return (return_highestLanePriority = 6), lanes & 8388096; case 8388608: case 16777216: case 33554432: case 67108864: - return (return_highestLanePriority = 5), lanes & 125829120; + return lanes & 130023424; case 134217728: - return (return_highestLanePriority = 4), 134217728; + return 134217728; case 268435456: - return (return_highestLanePriority = 3), 268435456; + return 268435456; case 536870912: - return (return_highestLanePriority = 2), 536870912; + return 536870912; case 1073741824: - return (return_highestLanePriority = 1), 1073741824; - default: - return (return_highestLanePriority = 8), lanes; - } -} -function lanePriorityToSchedulerPriority(lanePriority) { - switch (lanePriority) { - case 15: - case 14: - return 99; - case 13: - case 12: - case 11: - case 10: - return 98; - case 9: - case 8: - case 7: - case 6: - case 4: - case 5: - return 97; - case 3: - case 2: - case 1: - return 95; - case 0: - return 90; + return 1073741824; default: - throw Error( - "Invalid update priority: " + lanePriority + ". This is a bug in React." - ); + return lanes; } } function getNextLanes(root, wipLanes) { var pendingLanes = root.pendingLanes; - if (0 === pendingLanes) return (return_highestLanePriority = 0); + if (0 === pendingLanes) return 0; var nextLanes = 0, - nextLanePriority = 0, - expiredLanes = root.expiredLanes, suspendedLanes = root.suspendedLanes, - pingedLanes = root.pingedLanes; - 0 !== expiredLanes - ? ((nextLanes = expiredLanes), - (nextLanePriority = return_highestLanePriority = 15)) - : ((expiredLanes = pendingLanes & 268435455), - 0 !== expiredLanes - ? ((pendingLanes = expiredLanes & ~suspendedLanes), - 0 !== pendingLanes - ? ((nextLanes = getHighestPriorityLanes(pendingLanes)), - (nextLanePriority = return_highestLanePriority)) - : ((pingedLanes &= expiredLanes), - 0 !== pingedLanes && - ((nextLanes = getHighestPriorityLanes(pingedLanes)), - (nextLanePriority = return_highestLanePriority)))) - : ((pendingLanes &= ~suspendedLanes), - 0 !== pendingLanes - ? ((nextLanes = getHighestPriorityLanes(pendingLanes)), - (nextLanePriority = return_highestLanePriority)) - : 0 !== pingedLanes && - ((nextLanes = getHighestPriorityLanes(pingedLanes)), - (nextLanePriority = return_highestLanePriority)))); + pingedLanes = root.pingedLanes, + nonIdlePendingLanes = pendingLanes & 268435455; + 0 !== nonIdlePendingLanes + ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), + 0 !== pendingLanes + ? (nextLanes = getHighestPriorityLanes(pendingLanes)) + : ((pingedLanes &= nonIdlePendingLanes), + 0 !== pingedLanes && + (nextLanes = getHighestPriorityLanes(pingedLanes)))) + : ((nonIdlePendingLanes = pendingLanes & ~suspendedLanes), + 0 !== nonIdlePendingLanes + ? (nextLanes = getHighestPriorityLanes(nonIdlePendingLanes)) + : 0 !== pingedLanes && + (nextLanes = getHighestPriorityLanes(pingedLanes))); if (0 === nextLanes) return 0; if ( 0 !== wipLanes && wipLanes !== nextLanes && - 0 === (wipLanes & suspendedLanes) - ) { - getHighestPriorityLanes(wipLanes); - suspendedLanes = return_highestLanePriority; - if ( - nextLanePriority <= suspendedLanes || - (8 === nextLanePriority && 6 === suspendedLanes) - ) - return wipLanes; - return_highestLanePriority = nextLanePriority; - } + 0 === (wipLanes & suspendedLanes) && + ((suspendedLanes = nextLanes & -nextLanes), + (pingedLanes = wipLanes & -wipLanes), + suspendedLanes >= pingedLanes || + (16 === suspendedLanes && 0 !== (pingedLanes & 4194240))) + ) + return wipLanes; wipLanes = root.entangledLanes; if (0 !== wipLanes) for (root = root.entanglements, wipLanes &= nextLanes; 0 < wipLanes; ) - (nextLanePriority = 31 - clz32(wipLanes)), - (suspendedLanes = 1 << nextLanePriority), - (nextLanes |= root[nextLanePriority]), - (wipLanes &= ~suspendedLanes); + (suspendedLanes = 31 - clz32(wipLanes)), + (pingedLanes = 1 << suspendedLanes), + (nextLanes |= root[suspendedLanes]), + (wipLanes &= ~pingedLanes); return nextLanes; } +function computeExpirationTime(lane, currentTime) { + switch (lane) { + case 1: + case 2: + case 4: + return currentTime + 250; + case 8: + case 16: + case 32: + case 64: + case 128: + case 256: + case 512: + case 1024: + case 2048: + case 4096: + case 8192: + case 16384: + case 32768: + case 65536: + case 131072: + case 262144: + case 524288: + case 1048576: + case 2097152: + case 4194304: + case 8388608: + case 16777216: + case 33554432: + case 67108864: + return currentTime + 5e3; + case 134217728: + case 268435456: + case 536870912: + case 1073741824: + return -1; + default: + return -1; + } +} function getLanesToRetrySynchronouslyOnError(root) { root = root.pendingLanes & -1073741825; return 0 !== root ? root : root & 1073741824 ? 1073741824 : 0; } -function findUpdateLane(lanePriority) { - switch (lanePriority) { - case 15: - return 1; - case 14: - return 2; - case 12: - return 1; - case 10: - return 32; - case 8: - return 128; - case 2: - return 536870912; - } - throw Error( - "Invalid update priority: " + lanePriority + ". This is a bug in React." - ); -} function createLaneMap(initial) { for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial); return laneMap; @@ -1831,12 +1737,16 @@ function markRootUpdated(root, updateLane, eventTime) { updateLane = 31 - clz32(updateLane); root[updateLane] = eventTime; } +function markRootExpired(root, expiredLanes) { + root.entanglements[0] |= expiredLanes; + root.entangledLanes |= 1; + root.pendingLanes |= 1; +} function markRootFinished(root, remainingLanes) { var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; root.pendingLanes = remainingLanes; root.suspendedLanes = 0; root.pingedLanes = 0; - root.expiredLanes &= remainingLanes; root.mutableReadLanes &= remainingLanes; root.entangledLanes &= remainingLanes; remainingLanes = root.entanglements; @@ -1866,8 +1776,17 @@ var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback, function clz32Fallback(lanes) { return 0 === lanes ? 32 : (31 - ((log(lanes) / LN2) | 0)) | 0; } -var Scheduler_now$1 = Scheduler.unstable_now; -Scheduler_now$1(); +var currentUpdatePriority = 0; +function lanesToEventPriority(lanes) { + lanes &= -lanes; + return 1 < lanes + ? 4 < lanes + ? 0 !== (lanes & 268435455) + ? 16 + : 536870912 + : 4 + : 1; +} function shim() { throw Error( "The current renderer does not support mutation. This error is likely caused by a bug in React. Please file an issue." @@ -2082,7 +2001,16 @@ function invalidateContextProvider(workInProgress, type, didChange) { : pop(didPerformWorkStackCursor); push(didPerformWorkStackCursor, didChange); } -var rendererID = null, +var scheduleCallback = Scheduler.unstable_scheduleCallback, + cancelCallback = Scheduler.unstable_cancelCallback, + shouldYield = Scheduler.unstable_shouldYield, + requestPaint = Scheduler.unstable_requestPaint, + now = Scheduler.unstable_now, + ImmediatePriority = Scheduler.unstable_ImmediatePriority, + UserBlockingPriority = Scheduler.unstable_UserBlockingPriority, + NormalPriority = Scheduler.unstable_NormalPriority, + IdlePriority = Scheduler.unstable_IdlePriority, + rendererID = null, injectedHook = null; function onCommitRoot(root) { if (injectedHook && "function" === typeof injectedHook.onCommitFiberRoot) @@ -2095,6 +2023,32 @@ function onCommitRoot(root) { ); } catch (err) {} } +var syncQueue = null, + isFlushingSyncQueue = !1; +function flushSyncCallbackQueue() { + if (!isFlushingSyncQueue && null !== syncQueue) { + isFlushingSyncQueue = !0; + var i = 0, + previousUpdatePriority = currentUpdatePriority; + try { + var queue = syncQueue; + for (currentUpdatePriority = 1; i < queue.length; i++) { + var callback = queue[i]; + do callback = callback(!0); + while (null !== callback); + } + syncQueue = null; + } catch (error) { + throw (null !== syncQueue && (syncQueue = syncQueue.slice(i + 1)), + scheduleCallback(ImmediatePriority, flushSyncCallbackQueue), + error); + } finally { + (currentUpdatePriority = previousUpdatePriority), + (isFlushingSyncQueue = !1); + } + } + return null; +} var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; function is(x, y) { return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); @@ -2264,7 +2218,7 @@ function enqueueUpdate(fiber, update) { } function entangleTransitions(root, fiber, lane) { fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388096))) { + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 4194240))) { var queueLanes = fiber.lanes; queueLanes &= root.pendingLanes; lane |= queueLanes; @@ -3772,19 +3726,16 @@ function updateMemo(nextCreate, deps) { return nextCreate; } function startTransition(setPending, callback) { - var previousLanePriority = currentUpdateLanePriority; - currentUpdateLanePriority = - 0 !== previousLanePriority && 10 < previousLanePriority - ? previousLanePriority - : 10; + var previousPriority = currentUpdatePriority; + currentUpdatePriority = + 0 !== previousPriority && 4 > previousPriority ? previousPriority : 4; setPending(!0); - currentUpdateLanePriority = 8; var prevTransition = ReactCurrentBatchConfig$1.transition; ReactCurrentBatchConfig$1.transition = 1; try { setPending(!1), callback(); } finally { - (currentUpdateLanePriority = previousLanePriority), + (currentUpdatePriority = previousPriority), (ReactCurrentBatchConfig$1.transition = prevTransition); } } @@ -3840,7 +3791,7 @@ function dispatchAction(fiber, queue, action) { } finally { } update = scheduleUpdateOnFiber(fiber, lane, eventTime); - 0 !== (lane & 8388096) && + 0 !== (lane & 4194240) && null !== update && ((fiber = queue.lanes), (fiber &= update.pendingLanes), @@ -4560,7 +4511,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - (workInProgress.lanes = 8388608), + (workInProgress.lanes = 4194304), current ); renderLanes = createFiberFromOffscreen( @@ -5335,7 +5286,7 @@ function completeWork(current, workInProgress, renderLanes) { ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(type, !1), - (workInProgress.lanes = 8388608)); + (workInProgress.lanes = 4194304)); } else { if (!newProps) @@ -5362,7 +5313,7 @@ function completeWork(current, workInProgress, renderLanes) { ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(type, !1), - (workInProgress.lanes = 8388608)); + (workInProgress.lanes = 4194304)); type.isBackwards ? ((updatePayload.sibling = workInProgress.child), (workInProgress.child = updatePayload)) @@ -5672,7 +5623,9 @@ function commitHookEffectListMount(tag, finishedWork) { } } function detachFiberAfterEffects(fiber) { - fiber.alternate = null; + var alternate = fiber.alternate; + null !== alternate && + ((fiber.alternate = null), detachFiberAfterEffects(alternate)); fiber.child = null; fiber.deletions = null; fiber.dependencies = null; @@ -5734,17 +5687,13 @@ function attachSuspenseRetryListeners(finishedWork) { }); } } -function commitMutationEffects(root, renderPriorityLevel, firstChild) { +function commitMutationEffects(root, firstChild) { for (nextEffect = firstChild; null !== nextEffect; ) { root = nextEffect; - renderPriorityLevel = root.deletions; - if (null !== renderPriorityLevel) - for ( - firstChild = 0; - firstChild < renderPriorityLevel.length; - firstChild++ - ) { - var childToDelete = renderPriorityLevel[firstChild]; + firstChild = root.deletions; + if (null !== firstChild) + for (var i = 0; i < firstChild.length; i++) { + var childToDelete = firstChild[i]; try { a: for (var node = childToDelete; ; ) { var current = node; @@ -5822,15 +5771,15 @@ function commitMutationEffects(root, renderPriorityLevel, firstChild) { } } var alternate = childToDelete.alternate; - childToDelete.return = null; null !== alternate && (alternate.return = null); + childToDelete.return = null; } catch (error) { captureCommitPhaseError(childToDelete, root, error); } } - renderPriorityLevel = root.child; - if (0 !== (root.subtreeFlags & 6454) && null !== renderPriorityLevel) - (renderPriorityLevel.return = root), (nextEffect = renderPriorityLevel); + firstChild = root.child; + if (0 !== (root.subtreeFlags & 6454) && null !== firstChild) + (firstChild.return = root), (nextEffect = firstChild); else for (; null !== nextEffect; ) { root = nextEffect; @@ -5867,10 +5816,10 @@ function commitMutationEffects(root, renderPriorityLevel, firstChild) { } catch (error) { captureCommitPhaseError(root, root.return, error); } - renderPriorityLevel = root.sibling; - if (null !== renderPriorityLevel) { - renderPriorityLevel.return = root.return; - nextEffect = renderPriorityLevel; + firstChild = root.sibling; + if (null !== firstChild) { + firstChild.return = root.return; + nextEffect = firstChild; break; } nextEffect = root.return; @@ -6011,7 +5960,7 @@ var ceil = Math.ceil, legacyErrorBoundariesThatAlreadyFailed = null, rootDoesHavePassiveEffects = !1, rootWithPendingPassiveEffects = null, - pendingPassiveEffectsRenderPriority = 0, + pendingPassiveEffectsLanes = 0, nestedUpdateCount = 0, rootWithNestedUpdates = null, currentEventTime = -1, @@ -6024,20 +5973,18 @@ function requestEventTime() { : (currentEventTime = now()); } function requestUpdateLane(fiber) { - fiber = fiber.mode; - if (0 === (fiber & 1)) return 1; - if (0 === (fiber & 1)) return 15 === currentUpdateLanePriority ? 1 : 2; + if (0 === (fiber.mode & 1)) return 1; if (0 !== ReactCurrentBatchConfig.transition) return ( 0 === currentEventTransitionLane && ((fiber = nextTransitionLane), (nextTransitionLane <<= 1), - 0 === (nextTransitionLane & 8388096) && (nextTransitionLane = 512), + 0 === (nextTransitionLane & 4194240) && (nextTransitionLane = 64), (currentEventTransitionLane = fiber)), currentEventTransitionLane ); - fiber = currentUpdateLanePriority; - return 0 !== fiber ? findUpdateLane(fiber) : findUpdateLane(8); + fiber = currentUpdatePriority; + return 0 !== fiber ? fiber : 16; } function scheduleUpdateOnFiber(fiber, lane, eventTime) { if (50 < nestedUpdateCount) @@ -6083,7 +6030,8 @@ function ensureRootIsScheduled(root, currentTime) { suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes, expirationTimes = root.expirationTimes, - lanes = root.pendingLanes; + lanes = root.pendingLanes, + expiredLanes = 0; 0 < lanes; ) { @@ -6091,54 +6039,57 @@ function ensureRootIsScheduled(root, currentTime) { lane = 1 << index$5, expirationTime = expirationTimes[index$5]; if (-1 === expirationTime) { - if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) { - expirationTime = currentTime; - getHighestPriorityLanes(lane); - var priority = return_highestLanePriority; - expirationTimes[index$5] = - 10 <= priority - ? expirationTime + 250 - : 6 <= priority - ? expirationTime + 5e3 - : -1; - } - } else expirationTime <= currentTime && (root.expiredLanes |= lane); + if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) + expirationTimes[index$5] = computeExpirationTime(lane, currentTime); + } else expirationTime <= currentTime && (expiredLanes |= lane); lanes &= ~lane; } + 0 !== expiredLanes && markRootExpired(root, expiredLanes); suspendedLanes = getNextLanes( root, root === workInProgressRoot ? workInProgressRootRenderLanes : 0 ); - currentTime = return_highestLanePriority; - 0 === suspendedLanes - ? (null !== existingCallbackNode && - Scheduler_cancelCallback(existingCallbackNode), + if (0 === suspendedLanes) + null !== existingCallbackNode && cancelCallback(existingCallbackNode), (root.callbackNode = null), - (root.callbackPriority = 0)) - : root.callbackPriority !== currentTime && - (null != existingCallbackNode && - Scheduler_cancelCallback(existingCallbackNode), - 15 === currentTime - ? ((existingCallbackNode = performSyncWorkOnRoot.bind(null, root)), - null === syncQueue - ? (syncQueue = [existingCallbackNode]) - : syncQueue.push(existingCallbackNode), - scheduleCallback(99, flushSyncCallbackQueue), - (existingCallbackNode = null)) - : 14 === currentTime - ? (existingCallbackNode = scheduleCallback( - 99, - performSyncWorkOnRoot.bind(null, root) - )) - : ((existingCallbackNode = lanePriorityToSchedulerPriority( - currentTime - )), - (existingCallbackNode = scheduleCallback( - existingCallbackNode, - performConcurrentWorkOnRoot.bind(null, root) - ))), - (root.callbackPriority = currentTime), - (root.callbackNode = existingCallbackNode)); + (root.callbackPriority = 0); + else if ( + ((currentTime = suspendedLanes & -suspendedLanes), + root.callbackPriority !== currentTime) + ) { + null != existingCallbackNode && cancelCallback(existingCallbackNode); + if (1 === currentTime) + (existingCallbackNode = performSyncWorkOnRoot.bind(null, root)), + null === syncQueue + ? (syncQueue = [existingCallbackNode]) + : syncQueue.push(existingCallbackNode), + scheduleCallback(ImmediatePriority, flushSyncCallbackQueue), + (existingCallbackNode = null); + else { + switch (lanesToEventPriority(suspendedLanes)) { + case 1: + existingCallbackNode = ImmediatePriority; + break; + case 4: + existingCallbackNode = UserBlockingPriority; + break; + case 16: + existingCallbackNode = NormalPriority; + break; + case 536870912: + existingCallbackNode = IdlePriority; + break; + default: + existingCallbackNode = NormalPriority; + } + existingCallbackNode = scheduleCallback( + existingCallbackNode, + performConcurrentWorkOnRoot.bind(null, root) + ); + } + root.callbackPriority = currentTime; + root.callbackNode = existingCallbackNode; + } } function performConcurrentWorkOnRoot(root, didTimeout) { currentEventTime = -1; @@ -6155,9 +6106,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { if (0 === lanes) return null; if (didTimeout) return ( - (root.expiredLanes |= lanes & root.pendingLanes), - ensureRootIsScheduled(root, now()), - null + markRootExpired(root, lanes), ensureRootIsScheduled(root, now()), null ); didTimeout = lanes; var prevExecutionContext = executionContext; @@ -6209,7 +6158,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { case 3: markRootSuspended$1(root, lanes); if ( - (lanes & 125829120) === lanes && + (lanes & 130023424) === lanes && ((didTimeout = globalMostRecentFallbackTime + 500 - now()), 10 < didTimeout) ) { @@ -6230,7 +6179,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { break; case 4: markRootSuspended$1(root, lanes); - if ((lanes & 8388096) === lanes) break; + if ((lanes & 4194240) === lanes) break; didTimeout = root.eventTimes; for (prevExecutionContext = -1; 0 < lanes; ) { var index$4 = 31 - clz32(lanes); @@ -6292,11 +6241,10 @@ function performSyncWorkOnRoot(root) { if (0 !== (executionContext & 24)) throw Error("Should not already be working."); flushPassiveEffects(); - var lanes = - root === workInProgressRoot && - 0 !== (root.expiredLanes & workInProgressRootRenderLanes) - ? workInProgressRootRenderLanes - : getNextLanes(root, 0); + var lanes; + if ((lanes = root === workInProgressRoot)) + lanes = 0 !== (root.entanglements[0] & workInProgressRootRenderLanes); + lanes = lanes ? workInProgressRootRenderLanes : getNextLanes(root, 0); var exitStatus = renderRootSync(root, lanes); 0 !== root.tag && 2 === exitStatus && @@ -6609,7 +6557,7 @@ function workLoopSync() { for (; null !== workInProgress; ) performUnitOfWork(workInProgress); } function workLoopConcurrent() { - for (; null !== workInProgress && !Scheduler_shouldYield(); ) + for (; null !== workInProgress && !shouldYield(); ) performUnitOfWork(workInProgress); } function performUnitOfWork(unitOfWork) { @@ -6653,12 +6601,12 @@ function completeUnitOfWork(unitOfWork) { 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } function commitRoot(root) { - var previousUpdateLanePriority = currentUpdateLanePriority; + var previousUpdateLanePriority = currentUpdatePriority; try { - (currentUpdateLanePriority = 15), + (currentUpdatePriority = 1), commitRootImpl(root, previousUpdateLanePriority); } finally { - currentUpdateLanePriority = previousUpdateLanePriority; + currentUpdatePriority = previousUpdateLanePriority; } return null; } @@ -6687,30 +6635,29 @@ function commitRootImpl(root, renderPriorityLevel) { 0 === (finishedWork.flags & 1040)) || rootDoesHavePassiveEffects || ((rootDoesHavePassiveEffects = !0), - scheduleCallback(97, function() { + scheduleCallback(NormalPriority, function() { flushPassiveEffects(); return null; })); remainingLanes = 0 !== (finishedWork.flags & 8054); if (0 !== (finishedWork.subtreeFlags & 8054) || remainingLanes) { - remainingLanes = currentUpdateLanePriority; - currentUpdateLanePriority = 15; + remainingLanes = currentUpdatePriority; + currentUpdatePriority = 1; var prevExecutionContext = executionContext; executionContext |= 16; ReactCurrentOwner$2.current = null; commitBeforeMutationEffects(root, finishedWork); - commitMutationEffects(root, renderPriorityLevel, finishedWork); + commitMutationEffects(root, finishedWork); root.current = finishedWork; commitLayoutEffects(finishedWork, root, lanes); requestPaint(); executionContext = prevExecutionContext; - null != remainingLanes && (currentUpdateLanePriority = remainingLanes); + currentUpdatePriority = remainingLanes; } else root.current = finishedWork; rootDoesHavePassiveEffects && ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), - (pendingPassiveEffectsRenderPriority = - 0 === renderPriorityLevel ? 8 : renderPriorityLevel)); + (pendingPassiveEffectsLanes = lanes)); remainingLanes = root.pendingLanes; 0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null); 0 !== (remainingLanes & 1) @@ -6730,23 +6677,20 @@ function commitRootImpl(root, renderPriorityLevel) { return null; } function flushPassiveEffects() { - if (0 !== pendingPassiveEffectsRenderPriority) { - var priorityLevel = - 8 < pendingPassiveEffectsRenderPriority - ? 8 - : pendingPassiveEffectsRenderPriority; - pendingPassiveEffectsRenderPriority = 0; - var previousLanePriority = currentUpdateLanePriority; + if (0 !== pendingPassiveEffectsLanes) { + var b = lanesToEventPriority(pendingPassiveEffectsLanes), + previousPriority = currentUpdatePriority; try { - currentUpdateLanePriority = priorityLevel; + currentUpdatePriority = 16 < b ? 16 : b; if (null === rootWithPendingPassiveEffects) var JSCompiler_inline_result = !1; else { var root = rootWithPendingPassiveEffects; rootWithPendingPassiveEffects = null; + pendingPassiveEffectsLanes = 0; if (0 !== (executionContext & 24)) throw Error("Cannot flush passive effects while already rendering."); - priorityLevel = executionContext; + b = executionContext; executionContext |= 16; for (nextEffect = root.current; null !== nextEffect; ) { var fiber = nextEffect, @@ -6771,22 +6715,33 @@ function flushPassiveEffects() { else for (; null !== nextEffect; ) { fiber$jscomp$0 = nextEffect; + var sibling = fiber$jscomp$0.sibling, + returnFiber = fiber$jscomp$0.return; if (fiber$jscomp$0 === fiberToDelete) { + detachFiberAfterEffects(fiber$jscomp$0); nextEffect = null; break; } - var sibling = fiber$jscomp$0.sibling; if (null !== sibling) { - sibling.return = fiber$jscomp$0.return; + sibling.return = returnFiber; nextEffect = sibling; break; } - nextEffect = fiber$jscomp$0.return; + nextEffect = returnFiber; } } - var alternate = fiberToDelete.alternate; - detachFiberAfterEffects(fiberToDelete); - null !== alternate && detachFiberAfterEffects(alternate); + } + var previousFiber = fiber.alternate; + if (null !== previousFiber) { + var detachedChild = previousFiber.child; + if (null !== detachedChild) { + previousFiber.child = null; + do { + var detachedSibling = detachedChild.sibling; + detachedChild.sibling = null; + detachedChild = detachedSibling; + } while (null !== detachedChild); + } } nextEffect = fiber; } @@ -6845,13 +6800,13 @@ function flushPassiveEffects() { nextEffect = deletions.return; } } - executionContext = priorityLevel; + executionContext = b; flushSyncCallbackQueue(); JSCompiler_inline_result = !0; } return JSCompiler_inline_result; } finally { - currentUpdateLanePriority = previousLanePriority; + currentUpdatePriority = previousPriority; } } return !1; @@ -6921,7 +6876,7 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) { (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && (4 === workInProgressRootExitStatus || (3 === workInProgressRootExitStatus && - (workInProgressRootRenderLanes & 125829120) === + (workInProgressRootRenderLanes & 130023424) === workInProgressRootRenderLanes && 500 > now() - globalMostRecentFallbackTime) ? prepareFreshStack(root, 0) @@ -6933,14 +6888,11 @@ function resolveRetryWakeable(boundaryFiber, wakeable) { null !== retryCache && retryCache.delete(wakeable); wakeable = 0; 0 === wakeable && - ((wakeable = boundaryFiber.mode), - 0 === (wakeable & 1) + (0 === (boundaryFiber.mode & 1) ? (wakeable = 1) - : 0 === (wakeable & 1) - ? (wakeable = 15 === currentUpdateLanePriority ? 1 : 2) : ((wakeable = nextRetryLane), (nextRetryLane <<= 1), - 0 === (nextRetryLane & 125829120) && (nextRetryLane = 8388608))); + 0 === (nextRetryLane & 130023424) && (nextRetryLane = 4194304))); retryCache = requestEventTime(); boundaryFiber = markUpdateLaneFromFiberToRoot(boundaryFiber, wakeable); null !== boundaryFiber && @@ -7668,7 +7620,7 @@ function FiberRootNode(containerInfo, tag, hydrate) { this.callbackPriority = 0; this.eventTimes = createLaneMap(0); this.expirationTimes = createLaneMap(-1); - this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0; + this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0; this.entanglements = createLaneMap(0); } function createPortal(children, containerInfo, implementation) { @@ -7787,7 +7739,7 @@ var roots = new Map(), devToolsConfig$jscomp$inline_940 = { findFiberByHostInstance: getInstanceFromInstance, bundleType: 0, - version: "17.0.2", + version: "17.0.3", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function() { @@ -7802,7 +7754,7 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1182 = { +var internals$jscomp$inline_1171 = { bundleType: devToolsConfig$jscomp$inline_940.bundleType, version: devToolsConfig$jscomp$inline_940.version, rendererPackageName: devToolsConfig$jscomp$inline_940.rendererPackageName, @@ -7830,16 +7782,16 @@ var internals$jscomp$inline_1182 = { getCurrentFiber: null }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1183 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1172 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1183.isDisabled && - hook$jscomp$inline_1183.supportsFiber + !hook$jscomp$inline_1172.isDisabled && + hook$jscomp$inline_1172.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1183.inject( - internals$jscomp$inline_1182 + (rendererID = hook$jscomp$inline_1172.inject( + internals$jscomp$inline_1171 )), - (injectedHook = hook$jscomp$inline_1183); + (injectedHook = hook$jscomp$inline_1172); } catch (err) {} } exports.createPortal = function(children, containerTag) { diff --git a/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js b/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js index 64d1ba0f5c620f..5bb2ff1d2b3b06 100644 --- a/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +++ b/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<373c161f87d92aa90bcc7a1d42e0e19c>> + * @generated SignedSource<> */ "use strict"; @@ -930,7 +930,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_218 = { +var injectedNamesToPlugins$jscomp$inline_220 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -965,34 +965,34 @@ var injectedNamesToPlugins$jscomp$inline_218 = { } } }, - isOrderingDirty$jscomp$inline_219 = !1, - pluginName$jscomp$inline_220; -for (pluginName$jscomp$inline_220 in injectedNamesToPlugins$jscomp$inline_218) + isOrderingDirty$jscomp$inline_221 = !1, + pluginName$jscomp$inline_222; +for (pluginName$jscomp$inline_222 in injectedNamesToPlugins$jscomp$inline_220) if ( - injectedNamesToPlugins$jscomp$inline_218.hasOwnProperty( - pluginName$jscomp$inline_220 + injectedNamesToPlugins$jscomp$inline_220.hasOwnProperty( + pluginName$jscomp$inline_222 ) ) { - var pluginModule$jscomp$inline_221 = - injectedNamesToPlugins$jscomp$inline_218[pluginName$jscomp$inline_220]; + var pluginModule$jscomp$inline_223 = + injectedNamesToPlugins$jscomp$inline_220[pluginName$jscomp$inline_222]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_220) || - namesToPlugins[pluginName$jscomp$inline_220] !== - pluginModule$jscomp$inline_221 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_222) || + namesToPlugins[pluginName$jscomp$inline_222] !== + pluginModule$jscomp$inline_223 ) { - if (namesToPlugins[pluginName$jscomp$inline_220]) + if (namesToPlugins[pluginName$jscomp$inline_222]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - pluginName$jscomp$inline_220 + + pluginName$jscomp$inline_222 + "`." ); namesToPlugins[ - pluginName$jscomp$inline_220 - ] = pluginModule$jscomp$inline_221; - isOrderingDirty$jscomp$inline_219 = !0; + pluginName$jscomp$inline_222 + ] = pluginModule$jscomp$inline_223; + isOrderingDirty$jscomp$inline_221 = !0; } } -isOrderingDirty$jscomp$inline_219 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_221 && recomputePluginOrdering(); function getInstanceFromInstance(instanceHandle) { return instanceHandle; } @@ -1592,105 +1592,25 @@ function dispatchEvent(target, topLevelType, nativeEvent) { } }); } -var Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback, - Scheduler_cancelCallback = Scheduler.unstable_cancelCallback, - Scheduler_shouldYield = Scheduler.unstable_shouldYield, - Scheduler_requestPaint = Scheduler.unstable_requestPaint, - Scheduler_now = Scheduler.unstable_now, - Scheduler_ImmediatePriority = Scheduler.unstable_ImmediatePriority, - Scheduler_UserBlockingPriority = Scheduler.unstable_UserBlockingPriority, - Scheduler_NormalPriority = Scheduler.unstable_NormalPriority, - Scheduler_LowPriority = Scheduler.unstable_LowPriority, - Scheduler_IdlePriority = Scheduler.unstable_IdlePriority; -if ( - null == tracing.__interactionsRef || - null == tracing.__interactionsRef.current -) - throw Error( - "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at https://reactjs.org/link/profiling" - ); -var requestPaint = - void 0 !== Scheduler_requestPaint ? Scheduler_requestPaint : function() {}, - syncQueue = null, - isFlushingSyncQueue = !1, - initialTimeMs = Scheduler_now(), - now = - 1e4 > initialTimeMs - ? Scheduler_now - : function() { - return Scheduler_now() - initialTimeMs; - }; -function reactPriorityToSchedulerPriority(reactPriorityLevel) { - switch (reactPriorityLevel) { - case 99: - return Scheduler_ImmediatePriority; - case 98: - return Scheduler_UserBlockingPriority; - case 97: - return Scheduler_NormalPriority; - case 96: - return Scheduler_LowPriority; - case 95: - return Scheduler_IdlePriority; - default: - throw Error("Unknown priority level."); - } -} -function scheduleCallback(reactPriorityLevel, callback, options) { - reactPriorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); - return Scheduler_scheduleCallback(reactPriorityLevel, callback, options); -} -function flushSyncCallbackQueue() { - if (!isFlushingSyncQueue && null !== syncQueue) { - isFlushingSyncQueue = !0; - var i = 0, - previousLanePriority = currentUpdateLanePriority; - try { - var queue = syncQueue; - for (currentUpdateLanePriority = 15; i < queue.length; i++) { - var callback = queue[i]; - do callback = callback(!0); - while (null !== callback); - } - syncQueue = null; - } catch (error) { - throw (null !== syncQueue && (syncQueue = syncQueue.slice(i + 1)), - Scheduler_scheduleCallback( - Scheduler_ImmediatePriority, - flushSyncCallbackQueue - ), - error); - } finally { - (currentUpdateLanePriority = previousLanePriority), - (isFlushingSyncQueue = !1); - } - } - return null; -} -var currentUpdateLanePriority = 0, - nextTransitionLane = 512, - nextRetryLane = 8388608, - return_highestLanePriority = 8; +var nextTransitionLane = 64, + nextRetryLane = 4194304; function getHighestPriorityLanes(lanes) { switch (lanes & -lanes) { case 1: - return (return_highestLanePriority = 15), 1; + return 1; case 2: - return (return_highestLanePriority = 14), 2; + return 2; case 4: - return (return_highestLanePriority = 13), 4; + return 4; case 8: - return (return_highestLanePriority = 12), 8; + return 8; case 16: - return (return_highestLanePriority = 11), 16; + return 16; case 32: - return (return_highestLanePriority = 10), 32; + return 32; case 64: - return (return_highestLanePriority = 9), 64; case 128: - return (return_highestLanePriority = 8), 128; case 256: - return (return_highestLanePriority = 7), 256; case 512: case 1024: case 2048: @@ -1704,129 +1624,108 @@ function getHighestPriorityLanes(lanes) { case 524288: case 1048576: case 2097152: + return lanes & 4194240; case 4194304: - return (return_highestLanePriority = 6), lanes & 8388096; case 8388608: case 16777216: case 33554432: case 67108864: - return (return_highestLanePriority = 5), lanes & 125829120; + return lanes & 130023424; case 134217728: - return (return_highestLanePriority = 4), 134217728; + return 134217728; case 268435456: - return (return_highestLanePriority = 3), 268435456; + return 268435456; case 536870912: - return (return_highestLanePriority = 2), 536870912; + return 536870912; case 1073741824: - return (return_highestLanePriority = 1), 1073741824; - default: - return (return_highestLanePriority = 8), lanes; - } -} -function lanePriorityToSchedulerPriority(lanePriority) { - switch (lanePriority) { - case 15: - case 14: - return 99; - case 13: - case 12: - case 11: - case 10: - return 98; - case 9: - case 8: - case 7: - case 6: - case 4: - case 5: - return 97; - case 3: - case 2: - case 1: - return 95; - case 0: - return 90; + return 1073741824; default: - throw Error( - "Invalid update priority: " + lanePriority + ". This is a bug in React." - ); + return lanes; } } function getNextLanes(root, wipLanes) { var pendingLanes = root.pendingLanes; - if (0 === pendingLanes) return (return_highestLanePriority = 0); + if (0 === pendingLanes) return 0; var nextLanes = 0, - nextLanePriority = 0, - expiredLanes = root.expiredLanes, suspendedLanes = root.suspendedLanes, - pingedLanes = root.pingedLanes; - 0 !== expiredLanes - ? ((nextLanes = expiredLanes), - (nextLanePriority = return_highestLanePriority = 15)) - : ((expiredLanes = pendingLanes & 268435455), - 0 !== expiredLanes - ? ((pendingLanes = expiredLanes & ~suspendedLanes), - 0 !== pendingLanes - ? ((nextLanes = getHighestPriorityLanes(pendingLanes)), - (nextLanePriority = return_highestLanePriority)) - : ((pingedLanes &= expiredLanes), - 0 !== pingedLanes && - ((nextLanes = getHighestPriorityLanes(pingedLanes)), - (nextLanePriority = return_highestLanePriority)))) - : ((pendingLanes &= ~suspendedLanes), - 0 !== pendingLanes - ? ((nextLanes = getHighestPriorityLanes(pendingLanes)), - (nextLanePriority = return_highestLanePriority)) - : 0 !== pingedLanes && - ((nextLanes = getHighestPriorityLanes(pingedLanes)), - (nextLanePriority = return_highestLanePriority)))); + pingedLanes = root.pingedLanes, + nonIdlePendingLanes = pendingLanes & 268435455; + 0 !== nonIdlePendingLanes + ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), + 0 !== pendingLanes + ? (nextLanes = getHighestPriorityLanes(pendingLanes)) + : ((pingedLanes &= nonIdlePendingLanes), + 0 !== pingedLanes && + (nextLanes = getHighestPriorityLanes(pingedLanes)))) + : ((nonIdlePendingLanes = pendingLanes & ~suspendedLanes), + 0 !== nonIdlePendingLanes + ? (nextLanes = getHighestPriorityLanes(nonIdlePendingLanes)) + : 0 !== pingedLanes && + (nextLanes = getHighestPriorityLanes(pingedLanes))); if (0 === nextLanes) return 0; if ( 0 !== wipLanes && wipLanes !== nextLanes && - 0 === (wipLanes & suspendedLanes) - ) { - getHighestPriorityLanes(wipLanes); - suspendedLanes = return_highestLanePriority; - if ( - nextLanePriority <= suspendedLanes || - (8 === nextLanePriority && 6 === suspendedLanes) - ) - return wipLanes; - return_highestLanePriority = nextLanePriority; - } + 0 === (wipLanes & suspendedLanes) && + ((suspendedLanes = nextLanes & -nextLanes), + (pingedLanes = wipLanes & -wipLanes), + suspendedLanes >= pingedLanes || + (16 === suspendedLanes && 0 !== (pingedLanes & 4194240))) + ) + return wipLanes; wipLanes = root.entangledLanes; if (0 !== wipLanes) for (root = root.entanglements, wipLanes &= nextLanes; 0 < wipLanes; ) - (nextLanePriority = 31 - clz32(wipLanes)), - (suspendedLanes = 1 << nextLanePriority), - (nextLanes |= root[nextLanePriority]), - (wipLanes &= ~suspendedLanes); + (suspendedLanes = 31 - clz32(wipLanes)), + (pingedLanes = 1 << suspendedLanes), + (nextLanes |= root[suspendedLanes]), + (wipLanes &= ~pingedLanes); return nextLanes; } +function computeExpirationTime(lane, currentTime) { + switch (lane) { + case 1: + case 2: + case 4: + return currentTime + 250; + case 8: + case 16: + case 32: + case 64: + case 128: + case 256: + case 512: + case 1024: + case 2048: + case 4096: + case 8192: + case 16384: + case 32768: + case 65536: + case 131072: + case 262144: + case 524288: + case 1048576: + case 2097152: + case 4194304: + case 8388608: + case 16777216: + case 33554432: + case 67108864: + return currentTime + 5e3; + case 134217728: + case 268435456: + case 536870912: + case 1073741824: + return -1; + default: + return -1; + } +} function getLanesToRetrySynchronouslyOnError(root) { root = root.pendingLanes & -1073741825; return 0 !== root ? root : root & 1073741824 ? 1073741824 : 0; } -function findUpdateLane(lanePriority) { - switch (lanePriority) { - case 15: - return 1; - case 14: - return 2; - case 12: - return 1; - case 10: - return 32; - case 8: - return 128; - case 2: - return 536870912; - } - throw Error( - "Invalid update priority: " + lanePriority + ". This is a bug in React." - ); -} function createLaneMap(initial) { for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial); return laneMap; @@ -1839,12 +1738,16 @@ function markRootUpdated(root, updateLane, eventTime) { updateLane = 31 - clz32(updateLane); root[updateLane] = eventTime; } +function markRootExpired(root, expiredLanes) { + root.entanglements[0] |= expiredLanes; + root.entangledLanes |= 1; + root.pendingLanes |= 1; +} function markRootFinished(root, remainingLanes) { var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; root.pendingLanes = remainingLanes; root.suspendedLanes = 0; root.pingedLanes = 0; - root.expiredLanes &= remainingLanes; root.mutableReadLanes &= remainingLanes; root.entangledLanes &= remainingLanes; remainingLanes = root.entanglements; @@ -1874,15 +1777,17 @@ var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback, function clz32Fallback(lanes) { return 0 === lanes ? 32 : (31 - ((log(lanes) / LN2) | 0)) | 0; } -var Scheduler_now$1 = Scheduler.unstable_now; -if ( - null == tracing.__interactionsRef || - null == tracing.__interactionsRef.current -) - throw Error( - "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at https://reactjs.org/link/profiling" - ); -Scheduler_now$1(); +var currentUpdatePriority = 0; +function lanesToEventPriority(lanes) { + lanes &= -lanes; + return 1 < lanes + ? 4 < lanes + ? 0 !== (lanes & 268435455) + ? 16 + : 536870912 + : 4 + : 1; +} function shim() { throw Error( "The current renderer does not support mutation. This error is likely caused by a bug in React. Please file an issue." @@ -2097,17 +2002,45 @@ function invalidateContextProvider(workInProgress, type, didChange) { : pop(didPerformWorkStackCursor); push(didPerformWorkStackCursor, didChange); } +var scheduleCallback = Scheduler.unstable_scheduleCallback, + cancelCallback = Scheduler.unstable_cancelCallback, + shouldYield = Scheduler.unstable_shouldYield, + requestPaint = Scheduler.unstable_requestPaint, + now = Scheduler.unstable_now, + ImmediatePriority = Scheduler.unstable_ImmediatePriority, + UserBlockingPriority = Scheduler.unstable_UserBlockingPriority, + NormalPriority = Scheduler.unstable_NormalPriority, + IdlePriority = Scheduler.unstable_IdlePriority; +if ( + null == tracing.__interactionsRef || + null == tracing.__interactionsRef.current +) + throw Error( + "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at https://reactjs.org/link/profiling" + ); var rendererID = null, injectedHook = null, isDevToolsPresent = "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__; -function onCommitRoot(root, priorityLevel) { +function onCommitRoot(root, eventPriority) { if (injectedHook && "function" === typeof injectedHook.onCommitFiberRoot) try { - var didError = 128 === (root.current.flags & 128), - schedulerPriority = - 0 === priorityLevel - ? 97 - : lanePriorityToSchedulerPriority(priorityLevel); + var didError = 128 === (root.current.flags & 128); + switch (eventPriority) { + case 1: + var schedulerPriority = ImmediatePriority; + break; + case 4: + schedulerPriority = UserBlockingPriority; + break; + case 16: + schedulerPriority = NormalPriority; + break; + case 536870912: + schedulerPriority = IdlePriority; + break; + default: + schedulerPriority = NormalPriority; + } injectedHook.onCommitFiberRoot( rendererID, root, @@ -2116,6 +2049,32 @@ function onCommitRoot(root, priorityLevel) { ); } catch (err) {} } +var syncQueue = null, + isFlushingSyncQueue = !1; +function flushSyncCallbackQueue() { + if (!isFlushingSyncQueue && null !== syncQueue) { + isFlushingSyncQueue = !0; + var i = 0, + previousUpdatePriority = currentUpdatePriority; + try { + var queue = syncQueue; + for (currentUpdatePriority = 1; i < queue.length; i++) { + var callback = queue[i]; + do callback = callback(!0); + while (null !== callback); + } + syncQueue = null; + } catch (error) { + throw (null !== syncQueue && (syncQueue = syncQueue.slice(i + 1)), + scheduleCallback(ImmediatePriority, flushSyncCallbackQueue), + error); + } finally { + (currentUpdatePriority = previousUpdatePriority), + (isFlushingSyncQueue = !1); + } + } + return null; +} var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; function is(x, y) { return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); @@ -2285,7 +2244,7 @@ function enqueueUpdate(fiber, update) { } function entangleTransitions(root, fiber, lane) { fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388096))) { + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 4194240))) { var queueLanes = fiber.lanes; queueLanes &= root.pendingLanes; lane |= queueLanes; @@ -3793,19 +3752,16 @@ function updateMemo(nextCreate, deps) { return nextCreate; } function startTransition(setPending, callback) { - var previousLanePriority = currentUpdateLanePriority; - currentUpdateLanePriority = - 0 !== previousLanePriority && 10 < previousLanePriority - ? previousLanePriority - : 10; + var previousPriority = currentUpdatePriority; + currentUpdatePriority = + 0 !== previousPriority && 4 > previousPriority ? previousPriority : 4; setPending(!0); - currentUpdateLanePriority = 8; var prevTransition = ReactCurrentBatchConfig$1.transition; ReactCurrentBatchConfig$1.transition = 1; try { setPending(!1), callback(); } finally { - (currentUpdateLanePriority = previousLanePriority), + (currentUpdatePriority = previousPriority), (ReactCurrentBatchConfig$1.transition = prevTransition); } } @@ -3861,7 +3817,7 @@ function dispatchAction(fiber, queue, action) { } finally { } update = scheduleUpdateOnFiber(fiber, lane, eventTime); - 0 !== (lane & 8388096) && + 0 !== (lane & 4194240) && null !== update && ((fiber = queue.lanes), (fiber &= update.pendingLanes), @@ -4601,8 +4557,8 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - (workInProgress.lanes = 8388608), - markSpawnedWork(8388608), + (workInProgress.lanes = 4194304), + markSpawnedWork(4194304), current ); renderLanes = createFiberFromOffscreen( @@ -5436,8 +5392,8 @@ function completeWork(current, workInProgress, renderLanes) { ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(type, !1), - (workInProgress.lanes = 8388608), - markSpawnedWork(8388608)); + (workInProgress.lanes = 4194304), + markSpawnedWork(4194304)); } else { if (!newProps) @@ -5464,8 +5420,8 @@ function completeWork(current, workInProgress, renderLanes) { ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(type, !1), - (workInProgress.lanes = 8388608), - markSpawnedWork(8388608)); + (workInProgress.lanes = 4194304), + markSpawnedWork(4194304)); type.isBackwards ? ((updatePayload.sibling = workInProgress.child), (workInProgress.child = updatePayload)) @@ -5781,7 +5737,9 @@ function commitHookEffectListMount(tag, finishedWork) { } } function detachFiberAfterEffects(fiber) { - fiber.alternate = null; + var alternate = fiber.alternate; + null !== alternate && + ((fiber.alternate = null), detachFiberAfterEffects(alternate)); fiber.child = null; fiber.deletions = null; fiber.dependencies = null; @@ -5846,17 +5804,13 @@ function attachSuspenseRetryListeners(finishedWork) { }); } } -function commitMutationEffects(root, renderPriorityLevel, firstChild) { +function commitMutationEffects(root, firstChild) { for (nextEffect = firstChild; null !== nextEffect; ) { root = nextEffect; - renderPriorityLevel = root.deletions; - if (null !== renderPriorityLevel) - for ( - firstChild = 0; - firstChild < renderPriorityLevel.length; - firstChild++ - ) { - var childToDelete = renderPriorityLevel[firstChild]; + firstChild = root.deletions; + if (null !== firstChild) + for (var i = 0; i < firstChild.length; i++) { + var childToDelete = firstChild[i]; try { a: for (var node = childToDelete; ; ) { var current = node; @@ -5934,15 +5888,15 @@ function commitMutationEffects(root, renderPriorityLevel, firstChild) { } } var alternate = childToDelete.alternate; - childToDelete.return = null; null !== alternate && (alternate.return = null); + childToDelete.return = null; } catch (error) { captureCommitPhaseError(childToDelete, root, error); } } - renderPriorityLevel = root.child; - if (0 !== (root.subtreeFlags & 6454) && null !== renderPriorityLevel) - (renderPriorityLevel.return = root), (nextEffect = renderPriorityLevel); + firstChild = root.child; + if (0 !== (root.subtreeFlags & 6454) && null !== firstChild) + (firstChild.return = root), (nextEffect = firstChild); else for (; null !== nextEffect; ) { root = nextEffect; @@ -5979,10 +5933,10 @@ function commitMutationEffects(root, renderPriorityLevel, firstChild) { } catch (error) { captureCommitPhaseError(root, root.return, error); } - renderPriorityLevel = root.sibling; - if (null !== renderPriorityLevel) { - renderPriorityLevel.return = root.return; - nextEffect = renderPriorityLevel; + firstChild = root.sibling; + if (null !== firstChild) { + firstChild.return = root.return; + nextEffect = firstChild; break; } nextEffect = root.return; @@ -6146,7 +6100,6 @@ var ceil = Math.ceil, legacyErrorBoundariesThatAlreadyFailed = null, rootDoesHavePassiveEffects = !1, rootWithPendingPassiveEffects = null, - pendingPassiveEffectsRenderPriority = 0, pendingPassiveEffectsLanes = 0, nestedUpdateCount = 0, rootWithNestedUpdates = null, @@ -6161,20 +6114,18 @@ function requestEventTime() { : (currentEventTime = now()); } function requestUpdateLane(fiber) { - fiber = fiber.mode; - if (0 === (fiber & 1)) return 1; - if (0 === (fiber & 1)) return 15 === currentUpdateLanePriority ? 1 : 2; + if (0 === (fiber.mode & 1)) return 1; if (0 !== ReactCurrentBatchConfig.transition) return ( 0 === currentEventTransitionLane && ((fiber = nextTransitionLane), (nextTransitionLane <<= 1), - 0 === (nextTransitionLane & 8388096) && (nextTransitionLane = 512), + 0 === (nextTransitionLane & 4194240) && (nextTransitionLane = 64), (currentEventTransitionLane = fiber)), currentEventTransitionLane ); - fiber = currentUpdateLanePriority; - return 0 !== fiber ? findUpdateLane(fiber) : findUpdateLane(8); + fiber = currentUpdatePriority; + return 0 !== fiber ? fiber : 16; } function scheduleUpdateOnFiber(fiber, lane, eventTime) { if (50 < nestedUpdateCount) @@ -6222,7 +6173,8 @@ function ensureRootIsScheduled(root, currentTime) { suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes, expirationTimes = root.expirationTimes, - lanes = root.pendingLanes; + lanes = root.pendingLanes, + expiredLanes = 0; 0 < lanes; ) { @@ -6230,54 +6182,57 @@ function ensureRootIsScheduled(root, currentTime) { lane = 1 << index$5, expirationTime = expirationTimes[index$5]; if (-1 === expirationTime) { - if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) { - expirationTime = currentTime; - getHighestPriorityLanes(lane); - var priority = return_highestLanePriority; - expirationTimes[index$5] = - 10 <= priority - ? expirationTime + 250 - : 6 <= priority - ? expirationTime + 5e3 - : -1; - } - } else expirationTime <= currentTime && (root.expiredLanes |= lane); + if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) + expirationTimes[index$5] = computeExpirationTime(lane, currentTime); + } else expirationTime <= currentTime && (expiredLanes |= lane); lanes &= ~lane; } + 0 !== expiredLanes && markRootExpired(root, expiredLanes); suspendedLanes = getNextLanes( root, root === workInProgressRoot ? workInProgressRootRenderLanes : 0 ); - currentTime = return_highestLanePriority; - 0 === suspendedLanes - ? (null !== existingCallbackNode && - Scheduler_cancelCallback(existingCallbackNode), + if (0 === suspendedLanes) + null !== existingCallbackNode && cancelCallback(existingCallbackNode), (root.callbackNode = null), - (root.callbackPriority = 0)) - : root.callbackPriority !== currentTime && - (null != existingCallbackNode && - Scheduler_cancelCallback(existingCallbackNode), - 15 === currentTime - ? ((existingCallbackNode = performSyncWorkOnRoot.bind(null, root)), - null === syncQueue - ? (syncQueue = [existingCallbackNode]) - : syncQueue.push(existingCallbackNode), - scheduleCallback(99, flushSyncCallbackQueue), - (existingCallbackNode = null)) - : 14 === currentTime - ? (existingCallbackNode = scheduleCallback( - 99, - performSyncWorkOnRoot.bind(null, root) - )) - : ((existingCallbackNode = lanePriorityToSchedulerPriority( - currentTime - )), - (existingCallbackNode = scheduleCallback( - existingCallbackNode, - performConcurrentWorkOnRoot.bind(null, root) - ))), - (root.callbackPriority = currentTime), - (root.callbackNode = existingCallbackNode)); + (root.callbackPriority = 0); + else if ( + ((currentTime = suspendedLanes & -suspendedLanes), + root.callbackPriority !== currentTime) + ) { + null != existingCallbackNode && cancelCallback(existingCallbackNode); + if (1 === currentTime) + (existingCallbackNode = performSyncWorkOnRoot.bind(null, root)), + null === syncQueue + ? (syncQueue = [existingCallbackNode]) + : syncQueue.push(existingCallbackNode), + scheduleCallback(ImmediatePriority, flushSyncCallbackQueue), + (existingCallbackNode = null); + else { + switch (lanesToEventPriority(suspendedLanes)) { + case 1: + existingCallbackNode = ImmediatePriority; + break; + case 4: + existingCallbackNode = UserBlockingPriority; + break; + case 16: + existingCallbackNode = NormalPriority; + break; + case 536870912: + existingCallbackNode = IdlePriority; + break; + default: + existingCallbackNode = NormalPriority; + } + existingCallbackNode = scheduleCallback( + existingCallbackNode, + performConcurrentWorkOnRoot.bind(null, root) + ); + } + root.callbackPriority = currentTime; + root.callbackNode = existingCallbackNode; + } } function performConcurrentWorkOnRoot(root, didTimeout) { currentEventTime = -1; @@ -6294,9 +6249,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { if (0 === lanes) return null; if (didTimeout) return ( - (root.expiredLanes |= lanes & root.pendingLanes), - ensureRootIsScheduled(root, now()), - null + markRootExpired(root, lanes), ensureRootIsScheduled(root, now()), null ); var lanes$jscomp$0 = lanes; didTimeout = executionContext; @@ -6351,7 +6304,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { case 3: markRootSuspended$1(root, lanes); if ( - (lanes & 125829120) === lanes && + (lanes & 130023424) === lanes && ((didTimeout = globalMostRecentFallbackTime + 500 - now()), 10 < didTimeout) ) { @@ -6372,7 +6325,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { break; case 4: markRootSuspended$1(root, lanes); - if ((lanes & 8388096) === lanes) break; + if ((lanes & 4194240) === lanes) break; didTimeout = root.eventTimes; for (prevDispatcher = -1; 0 < lanes; ) { var index$4 = 31 - clz32(lanes); @@ -6434,11 +6387,10 @@ function performSyncWorkOnRoot(root) { if (0 !== (executionContext & 24)) throw Error("Should not already be working."); flushPassiveEffects(); - var lanes = - root === workInProgressRoot && - 0 !== (root.expiredLanes & workInProgressRootRenderLanes) - ? workInProgressRootRenderLanes - : getNextLanes(root, 0); + var lanes; + if ((lanes = root === workInProgressRoot)) + lanes = 0 !== (root.entanglements[0] & workInProgressRootRenderLanes); + lanes = lanes ? workInProgressRootRenderLanes : getNextLanes(root, 0); var exitStatus = renderRootSync(root, lanes); 0 !== root.tag && 2 === exitStatus && @@ -6761,7 +6713,7 @@ function workLoopSync() { for (; null !== workInProgress; ) performUnitOfWork(workInProgress); } function workLoopConcurrent() { - for (; null !== workInProgress && !Scheduler_shouldYield(); ) + for (; null !== workInProgress && !shouldYield(); ) performUnitOfWork(workInProgress); } function performUnitOfWork(unitOfWork) { @@ -6826,12 +6778,12 @@ function completeUnitOfWork(unitOfWork) { 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } function commitRoot(root) { - var previousUpdateLanePriority = currentUpdateLanePriority; + var previousUpdateLanePriority = currentUpdatePriority; try { - (currentUpdateLanePriority = 15), + (currentUpdatePriority = 1), commitRootImpl(root, previousUpdateLanePriority); } finally { - currentUpdateLanePriority = previousUpdateLanePriority; + currentUpdatePriority = previousUpdateLanePriority; } return null; } @@ -6860,34 +6812,32 @@ function commitRootImpl(root, renderPriorityLevel) { 0 === (finishedWork.flags & 1040)) || rootDoesHavePassiveEffects || ((rootDoesHavePassiveEffects = !0), - scheduleCallback(97, function() { + scheduleCallback(NormalPriority, function() { flushPassiveEffects(); return null; })); remainingLanes = 0 !== (finishedWork.flags & 8054); if (0 !== (finishedWork.subtreeFlags & 8054) || remainingLanes) { - remainingLanes = currentUpdateLanePriority; - currentUpdateLanePriority = 15; + remainingLanes = currentUpdatePriority; + currentUpdatePriority = 1; var prevExecutionContext = executionContext; executionContext |= 16; var prevInteractions = pushInteractions(root); ReactCurrentOwner$2.current = null; commitBeforeMutationEffects(root, finishedWork); commitTime = now$1(); - commitMutationEffects(root, renderPriorityLevel, finishedWork); + commitMutationEffects(root, finishedWork); root.current = finishedWork; commitLayoutEffects(finishedWork, root, lanes); requestPaint(); tracing.__interactionsRef.current = prevInteractions; executionContext = prevExecutionContext; - null != remainingLanes && (currentUpdateLanePriority = remainingLanes); + currentUpdatePriority = remainingLanes; } else (root.current = finishedWork), (commitTime = now$1()); if ((prevExecutionContext = rootDoesHavePassiveEffects)) (rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), - (pendingPassiveEffectsLanes = lanes), - (pendingPassiveEffectsRenderPriority = - 0 === renderPriorityLevel ? 8 : renderPriorityLevel); + (pendingPassiveEffectsLanes = lanes); remainingLanes = root.pendingLanes; if (0 !== remainingLanes) { if (null !== spawnedWorkDuringRender) { @@ -6920,19 +6870,15 @@ function commitRootImpl(root, renderPriorityLevel) { return null; } function flushPassiveEffects() { - if (0 !== pendingPassiveEffectsRenderPriority) { - var priorityLevel = - 8 < pendingPassiveEffectsRenderPriority - ? 8 - : pendingPassiveEffectsRenderPriority; - pendingPassiveEffectsRenderPriority = 0; - var previousLanePriority = currentUpdateLanePriority; + if (0 !== pendingPassiveEffectsLanes) { + var b = lanesToEventPriority(pendingPassiveEffectsLanes), + previousPriority = currentUpdatePriority; try { - currentUpdateLanePriority = priorityLevel; + currentUpdatePriority = 16 < b ? 16 : b; if (null === rootWithPendingPassiveEffects) var JSCompiler_inline_result = !1; else { - priorityLevel = rootWithPendingPassiveEffects; + b = rootWithPendingPassiveEffects; var lanes = pendingPassiveEffectsLanes; rootWithPendingPassiveEffects = null; pendingPassiveEffectsLanes = 0; @@ -6940,8 +6886,8 @@ function flushPassiveEffects() { throw Error("Cannot flush passive effects while already rendering."); var prevExecutionContext = executionContext; executionContext |= 16; - var prevInteractions = pushInteractions(priorityLevel); - for (nextEffect = priorityLevel.current; null !== nextEffect; ) { + var prevInteractions = pushInteractions(b); + for (nextEffect = b.current; null !== nextEffect; ) { var fiber = nextEffect, child = fiber.child; if (0 !== (nextEffect.flags & 16)) { @@ -6964,22 +6910,33 @@ function flushPassiveEffects() { else for (; null !== nextEffect; ) { fiber$jscomp$0 = nextEffect; + var sibling = fiber$jscomp$0.sibling, + returnFiber = fiber$jscomp$0.return; if (fiber$jscomp$0 === fiberToDelete) { + detachFiberAfterEffects(fiber$jscomp$0); nextEffect = null; break; } - var sibling = fiber$jscomp$0.sibling; if (null !== sibling) { - sibling.return = fiber$jscomp$0.return; + sibling.return = returnFiber; nextEffect = sibling; break; } - nextEffect = fiber$jscomp$0.return; + nextEffect = returnFiber; } } - var alternate = fiberToDelete.alternate; - detachFiberAfterEffects(fiberToDelete); - null !== alternate && detachFiberAfterEffects(alternate); + } + var previousFiber = fiber.alternate; + if (null !== previousFiber) { + var detachedChild = previousFiber.child; + if (null !== detachedChild) { + previousFiber.child = null; + do { + var detachedSibling = detachedChild.sibling; + detachedChild.sibling = null; + detachedChild = detachedSibling; + } while (null !== detachedChild); + } } nextEffect = fiber; } @@ -7005,7 +6962,7 @@ function flushPassiveEffects() { nextEffect = fiber.return; } } - var finishedWork = priorityLevel.current; + var finishedWork = b.current; for (nextEffect = finishedWork; null !== nextEffect; ) { child = nextEffect; var firstChild = child.child; @@ -7039,14 +6996,14 @@ function flushPassiveEffects() { } } tracing.__interactionsRef.current = prevInteractions; - finishPendingInteractions(priorityLevel, lanes); + finishPendingInteractions(b, lanes); executionContext = prevExecutionContext; flushSyncCallbackQueue(); JSCompiler_inline_result = !0; } return JSCompiler_inline_result; } finally { - currentUpdateLanePriority = previousLanePriority; + currentUpdatePriority = previousPriority; } } return !1; @@ -7118,7 +7075,7 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) { (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && (4 === workInProgressRootExitStatus || (3 === workInProgressRootExitStatus && - (workInProgressRootRenderLanes & 125829120) === + (workInProgressRootRenderLanes & 130023424) === workInProgressRootRenderLanes && 500 > now() - globalMostRecentFallbackTime) ? prepareFreshStack(root, 0) @@ -7131,14 +7088,11 @@ function resolveRetryWakeable(boundaryFiber, wakeable) { null !== retryCache && retryCache.delete(wakeable); wakeable = 0; 0 === wakeable && - ((wakeable = boundaryFiber.mode), - 0 === (wakeable & 1) + (0 === (boundaryFiber.mode & 1) ? (wakeable = 1) - : 0 === (wakeable & 1) - ? (wakeable = 15 === currentUpdateLanePriority ? 1 : 2) : ((wakeable = nextRetryLane), (nextRetryLane <<= 1), - 0 === (nextRetryLane & 125829120) && (nextRetryLane = 8388608))); + 0 === (nextRetryLane & 130023424) && (nextRetryLane = 4194304))); retryCache = requestEventTime(); boundaryFiber = markUpdateLaneFromFiberToRoot(boundaryFiber, wakeable); null !== boundaryFiber && @@ -7722,7 +7676,7 @@ function startWorkOnPendingInteractions(root, lanes) { try { subscriber.onWorkStarted(interactions, root); } catch (error) { - scheduleCallback(99, function() { + scheduleCallback(ImmediatePriority, function() { throw error; }); } @@ -7739,7 +7693,7 @@ function finishPendingInteractions(root, committedLanes) { 1e3 * committedLanes + root.interactionThreadID ); } catch (error) { - scheduleCallback(99, function() { + scheduleCallback(ImmediatePriority, function() { throw error; }); } finally { @@ -7753,7 +7707,7 @@ function finishPendingInteractions(root, committedLanes) { try { subscriber.onInteractionScheduledWorkCompleted(interaction); } catch (error$95) { - scheduleCallback(99, function() { + scheduleCallback(ImmediatePriority, function() { throw error$95; }); } @@ -7967,7 +7921,7 @@ function FiberRootNode(containerInfo, tag, hydrate) { this.callbackPriority = 0; this.eventTimes = createLaneMap(0); this.expirationTimes = createLaneMap(-1); - this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0; + this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0; this.entanglements = createLaneMap(0); this.interactionThreadID = tracing.unstable_getThreadID(); this.memoizedInteractions = new Set(); @@ -8089,7 +8043,7 @@ var roots = new Map(), devToolsConfig$jscomp$inline_968 = { findFiberByHostInstance: getInstanceFromInstance, bundleType: 0, - version: "17.0.2", + version: "17.0.3", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function() { @@ -8104,7 +8058,7 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1223 = { +var internals$jscomp$inline_1212 = { bundleType: devToolsConfig$jscomp$inline_968.bundleType, version: devToolsConfig$jscomp$inline_968.version, rendererPackageName: devToolsConfig$jscomp$inline_968.rendererPackageName, @@ -8132,16 +8086,16 @@ var internals$jscomp$inline_1223 = { getCurrentFiber: null }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1224 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1213 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1224.isDisabled && - hook$jscomp$inline_1224.supportsFiber + !hook$jscomp$inline_1213.isDisabled && + hook$jscomp$inline_1213.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1224.inject( - internals$jscomp$inline_1223 + (rendererID = hook$jscomp$inline_1213.inject( + internals$jscomp$inline_1212 )), - (injectedHook = hook$jscomp$inline_1224); + (injectedHook = hook$jscomp$inline_1213); } catch (err) {} } exports.createPortal = function(children, containerTag) { diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js b/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js index 02177c3d895382..c9d6478d841574 100644 --- a/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<2fe382d0e0ada2126f1d6c90e3d2ef1d>> + * @generated SignedSource<<31b307087773581fd58a1b6ae0a24ae9>> */ 'use strict'; @@ -4093,162 +4093,6 @@ var ReactNativeFiberHostComponent = /*#__PURE__*/ (function() { return ReactNativeFiberHostComponent; })(); // eslint-disable-next-line no-unused-expressions -// Intentionally not named imports because Rollup would use dynamic dispatch for -var Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback, - Scheduler_cancelCallback = Scheduler.unstable_cancelCallback, - Scheduler_shouldYield = Scheduler.unstable_shouldYield, - Scheduler_requestPaint = Scheduler.unstable_requestPaint, - Scheduler_now = Scheduler.unstable_now, - Scheduler_ImmediatePriority = Scheduler.unstable_ImmediatePriority, - Scheduler_UserBlockingPriority = Scheduler.unstable_UserBlockingPriority, - Scheduler_NormalPriority = Scheduler.unstable_NormalPriority, - Scheduler_LowPriority = Scheduler.unstable_LowPriority, - Scheduler_IdlePriority = Scheduler.unstable_IdlePriority; - -{ - // Provide explicit error message when production+profiling bundle of e.g. - // react-dom is used with production (non-profiling) bundle of - // scheduler/tracing - if ( - !( - tracing.__interactionsRef != null && - tracing.__interactionsRef.current != null - ) - ) { - throw Error( - "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at https://reactjs.org/link/profiling" - ); - } -} - -// Except for NoPriority, these correspond to Scheduler priorities. We use -// ascending numbers so we can compare them like numbers. They start at 90 to -// avoid clashing with Scheduler's priorities. -var ImmediatePriority = 99; -var UserBlockingPriority = 98; -var NormalPriority = 97; -var LowPriority = 96; -var IdlePriority = 95; // NoPriority is the absence of priority. Also React-only. - -var NoPriority = 90; -var shouldYield = Scheduler_shouldYield; -var requestPaint = // Fall back gracefully if we're running an older version of Scheduler. - Scheduler_requestPaint !== undefined ? Scheduler_requestPaint : function() {}; -var syncQueue = null; -var isFlushingSyncQueue = false; -var initialTimeMs = Scheduler_now(); // If the initial timestamp is reasonably small, use Scheduler's `now` directly. -// This will be the case for modern browsers that support `performance.now`. In -// older browsers, Scheduler falls back to `Date.now`, which returns a Unix -// timestamp. In that case, subtract the module initialization time to simulate -// the behavior of performance.now and keep our times small enough to fit -// within 32 bits. -// TODO: Consider lifting this into Scheduler. - -var now = - initialTimeMs < 10000 - ? Scheduler_now - : function() { - return Scheduler_now() - initialTimeMs; - }; - -function reactPriorityToSchedulerPriority(reactPriorityLevel) { - switch (reactPriorityLevel) { - case ImmediatePriority: - return Scheduler_ImmediatePriority; - - case UserBlockingPriority: - return Scheduler_UserBlockingPriority; - - case NormalPriority: - return Scheduler_NormalPriority; - - case LowPriority: - return Scheduler_LowPriority; - - case IdlePriority: - return Scheduler_IdlePriority; - - default: { - throw Error("Unknown priority level."); - } - } -} - -function scheduleCallback(reactPriorityLevel, callback, options) { - var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); - return Scheduler_scheduleCallback(priorityLevel, callback, options); -} -function scheduleSyncCallback(callback) { - // Push this callback into an internal queue. We'll flush these either in - // the next tick, or earlier if something calls `flushSyncCallbackQueue`. - if (syncQueue === null) { - syncQueue = [callback]; - } else { - // Push onto existing queue. Don't need to schedule a callback because - // we already scheduled one when we created the queue. - syncQueue.push(callback); - } -} -function cancelCallback(callbackNode) { - Scheduler_cancelCallback(callbackNode); -} -function flushSyncCallbackQueue() { - if (!isFlushingSyncQueue && syncQueue !== null) { - // Prevent re-entrancy. - isFlushingSyncQueue = true; - var i = 0; - var previousLanePriority = getCurrentUpdateLanePriority(); - - try { - var _isSync = true; - var queue = syncQueue; - setCurrentUpdateLanePriority(SyncLanePriority); - - for (; i < queue.length; i++) { - var callback = queue[i]; - - do { - callback = callback(_isSync); - } while (callback !== null); - } - - syncQueue = null; - } catch (error) { - // If something throws, leave the remaining callbacks on the queue. - if (syncQueue !== null) { - syncQueue = syncQueue.slice(i + 1); - } // Resume flushing in the next tick - - Scheduler_scheduleCallback( - Scheduler_ImmediatePriority, - flushSyncCallbackQueue - ); - throw error; - } finally { - setCurrentUpdateLanePriority(previousLanePriority); - isFlushingSyncQueue = false; - } - } - - return null; -} - -var SyncLanePriority = 15; -var SyncBatchedLanePriority = 14; -var InputDiscreteHydrationLanePriority = 13; -var InputDiscreteLanePriority = 12; -var InputContinuousHydrationLanePriority = 11; -var InputContinuousLanePriority = 10; -var DefaultHydrationLanePriority = 9; -var DefaultLanePriority = 8; -var TransitionHydrationPriority = 7; -var TransitionPriority = 6; -var RetryLanePriority = 5; -var SelectiveHydrationLanePriority = 4; -var IdleHydrationLanePriority = 3; -var IdleLanePriority = 2; -var OffscreenLanePriority = 1; -var NoLanePriority = 0; // Lane values below should be kept in sync with getLabelsForLanes(), used by react-devtools-scheduling-profiler. // If those values are changed that package should be rebuilt and redeployed. var TotalLanes = 31; @@ -4261,88 +4105,88 @@ var NoLane = var SyncLane = /* */ 1; -var SyncBatchedLane = - /* */ - 2; -var InputDiscreteHydrationLane = - /* */ - 4; -var InputDiscreteLane = - /* */ - 8; var InputContinuousHydrationLane = /* */ - 16; + 2; var InputContinuousLane = /* */ - 32; + 4; var DefaultHydrationLane = /* */ - 64; + 8; var DefaultLane = /* */ - 128; + 16; var TransitionHydrationLane = /* */ - 256; + 32; var TransitionLanes = /* */ - 8388096; + 4194240; var TransitionLane1 = /* */ - 512; + 64; var TransitionLane2 = /* */ - 1024; + 128; var TransitionLane3 = /* */ - 2048; + 256; var TransitionLane4 = /* */ - 4096; + 512; var TransitionLane5 = /* */ - 8192; + 1024; var TransitionLane6 = /* */ - 16384; + 2048; var TransitionLane7 = /* */ - 32768; + 4096; var TransitionLane8 = /* */ - 65536; + 8192; var TransitionLane9 = /* */ - 131072; + 16384; var TransitionLane10 = /* */ - 262144; + 32768; var TransitionLane11 = /* */ - 524288; + 65536; var TransitionLane12 = /* */ - 1048576; + 131072; var TransitionLane13 = /* */ - 2097152; + 262144; var TransitionLane14 = /* */ - 4194304; + 524288; +var TransitionLane15 = + /* */ + 1048576; +var TransitionLane16 = + /* */ + 2097152; var RetryLanes = /* */ - 125829120; + 130023424; var RetryLane1 = /* */ - 8388608; + 4194304; var RetryLane2 = /* */ - 16777216; + 8388608; var RetryLane3 = /* */ - 33554432; + 16777216; var RetryLane4 = + /* */ + 33554432; +var RetryLane5 = /* */ 67108864; var SomeRetryLane = RetryLane1; @@ -4356,61 +4200,33 @@ var IdleHydrationLane = /* */ 268435456; var IdleLane = - /* */ + /* */ 536870912; var OffscreenLane = /* */ 1073741824; // This function is used for the experimental scheduling profiler (react-devtools-scheduling-profiler) var NoTimestamp = -1; -var currentUpdateLanePriority = NoLanePriority; var nextTransitionLane = TransitionLane1; var nextRetryLane = RetryLane1; -function getCurrentUpdateLanePriority() { - return currentUpdateLanePriority; -} -function setCurrentUpdateLanePriority(newLanePriority) { - currentUpdateLanePriority = newLanePriority; -} // "Registers" used to "return" multiple values -// Used by getHighestPriorityLanes and getNextLanes: - -var return_highestLanePriority = DefaultLanePriority; function getHighestPriorityLanes(lanes) { switch (getHighestPriorityLane(lanes)) { case SyncLane: - return_highestLanePriority = SyncLanePriority; return SyncLane; - case SyncBatchedLane: - return_highestLanePriority = SyncBatchedLanePriority; - return SyncBatchedLane; - - case InputDiscreteHydrationLane: - return_highestLanePriority = InputDiscreteHydrationLanePriority; - return InputDiscreteHydrationLane; - - case InputDiscreteLane: - return_highestLanePriority = InputDiscreteLanePriority; - return InputDiscreteLane; - case InputContinuousHydrationLane: - return_highestLanePriority = InputContinuousHydrationLanePriority; return InputContinuousHydrationLane; case InputContinuousLane: - return_highestLanePriority = InputContinuousLanePriority; return InputContinuousLane; case DefaultHydrationLane: - return_highestLanePriority = DefaultHydrationLanePriority; return DefaultHydrationLane; case DefaultLane: - return_highestLanePriority = DefaultLanePriority; return DefaultLane; case TransitionHydrationLane: - return_highestLanePriority = TransitionHydrationPriority; return TransitionHydrationLane; case TransitionLane1: @@ -4427,30 +4243,27 @@ function getHighestPriorityLanes(lanes) { case TransitionLane12: case TransitionLane13: case TransitionLane14: - return_highestLanePriority = TransitionPriority; + case TransitionLane15: + case TransitionLane16: return lanes & TransitionLanes; case RetryLane1: case RetryLane2: case RetryLane3: case RetryLane4: - return_highestLanePriority = RetryLanePriority; + case RetryLane5: return lanes & RetryLanes; case SelectiveHydrationLane: - return_highestLanePriority = SelectiveHydrationLanePriority; return SelectiveHydrationLane; case IdleHydrationLane: - return_highestLanePriority = IdleHydrationLanePriority; return IdleHydrationLane; case IdleLane: - return_highestLanePriority = IdleLanePriority; return IdleLane; case OffscreenLane: - return_highestLanePriority = OffscreenLanePriority; return OffscreenLane; default: @@ -4458,96 +4271,46 @@ function getHighestPriorityLanes(lanes) { error("Should have found matching lanes. This is a bug in React."); } // This shouldn't be reachable, but as a fallback, return the entire bitmask. - return_highestLanePriority = DefaultLanePriority; return lanes; } } -function lanePriorityToSchedulerPriority(lanePriority) { - switch (lanePriority) { - case SyncLanePriority: - case SyncBatchedLanePriority: - return ImmediatePriority; - - case InputDiscreteHydrationLanePriority: - case InputDiscreteLanePriority: - case InputContinuousHydrationLanePriority: - case InputContinuousLanePriority: - return UserBlockingPriority; - - case DefaultHydrationLanePriority: - case DefaultLanePriority: - case TransitionHydrationPriority: - case TransitionPriority: - case SelectiveHydrationLanePriority: - case RetryLanePriority: - return NormalPriority; - - case IdleHydrationLanePriority: - case IdleLanePriority: - case OffscreenLanePriority: - return IdlePriority; - - case NoLanePriority: - return NoPriority; - - default: { - throw Error( - "Invalid update priority: " + lanePriority + ". This is a bug in React." - ); - } - } -} function getNextLanes(root, wipLanes) { // Early bailout if there's no pending work left. var pendingLanes = root.pendingLanes; if (pendingLanes === NoLanes) { - return_highestLanePriority = NoLanePriority; return NoLanes; } var nextLanes = NoLanes; - var nextLanePriority = NoLanePriority; - var expiredLanes = root.expiredLanes; var suspendedLanes = root.suspendedLanes; - var pingedLanes = root.pingedLanes; // Check if any work has expired. + var pingedLanes = root.pingedLanes; // Do not work on any idle work until all the non-idle work has finished, + // even if the work is suspended. - if (expiredLanes !== NoLanes) { - // TODO: Should entangle with SyncLane - nextLanes = expiredLanes; - nextLanePriority = return_highestLanePriority = SyncLanePriority; - } else { - // Do not work on any idle work until all the non-idle work has finished, - // even if the work is suspended. - var nonIdlePendingLanes = pendingLanes & NonIdleLanes; + var nonIdlePendingLanes = pendingLanes & NonIdleLanes; - if (nonIdlePendingLanes !== NoLanes) { - var nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes; + if (nonIdlePendingLanes !== NoLanes) { + var nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes; - if (nonIdleUnblockedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes); - nextLanePriority = return_highestLanePriority; - } else { - var nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes; + if (nonIdleUnblockedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes); + } else { + var nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes; - if (nonIdlePingedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(nonIdlePingedLanes); - nextLanePriority = return_highestLanePriority; - } + if (nonIdlePingedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(nonIdlePingedLanes); } - } else { - // The only remaining work is Idle. - var unblockedLanes = pendingLanes & ~suspendedLanes; + } + } else { + // The only remaining work is Idle. + var unblockedLanes = pendingLanes & ~suspendedLanes; - if (unblockedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(unblockedLanes); - nextLanePriority = return_highestLanePriority; - } else { - if (pingedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(pingedLanes); - nextLanePriority = return_highestLanePriority; - } + if (unblockedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(unblockedLanes); + } else { + if (pingedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(pingedLanes); } } } @@ -4566,20 +4329,19 @@ function getNextLanes(root, wipLanes) { // bother waiting until the root is complete. (wipLanes & suspendedLanes) === NoLanes ) { - getHighestPriorityLanes(wipLanes); - var wipLanePriority = return_highestLanePriority; + var nextLane = getHighestPriorityLane(nextLanes); + var wipLane = getHighestPriorityLane(wipLanes); if ( - nextLanePriority <= wipLanePriority || // Default priority updates should not interrupt transition updates. The + // Tests whether the next lane is equal or lower priority than the wip + // one. This works because the bits decrease in priority as you go left. + nextLane >= wipLane || // Default priority updates should not interrupt transition updates. The // only difference between default updates and transition updates is that // default updates do not support refresh transitions. - (nextLanePriority === DefaultLanePriority && - wipLanePriority === TransitionPriority) + (nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes) ) { // Keep working on the existing in-progress tree. Do not interrupt. return wipLanes; - } else { - return_highestLanePriority = nextLanePriority; } } // Check for entangled lanes and add them to the batch. // @@ -4640,32 +4402,60 @@ function getMostRecentEventTime(root, lanes) { } function computeExpirationTime(lane, currentTime) { - // TODO: Expiration heuristic is constant per lane, so could use a map. - getHighestPriorityLanes(lane); - var priority = return_highestLanePriority; + switch (lane) { + case SyncLane: + case InputContinuousHydrationLane: + case InputContinuousLane: + // User interactions should expire slightly more quickly. + // + // NOTE: This is set to the corresponding constant as in Scheduler.js. + // When we made it larger, a product metric in www regressed, suggesting + // there's a user interaction that's being starved by a series of + // synchronous updates. If that theory is correct, the proper solution is + // to fix the starvation. However, this scenario supports the idea that + // expiration times are an important safeguard when starvation + // does happen. + return currentTime + 250; - if (priority >= InputContinuousLanePriority) { - // User interactions should expire slightly more quickly. - // - // NOTE: This is set to the corresponding constant as in Scheduler.js. When - // we made it larger, a product metric in www regressed, suggesting there's - // a user interaction that's being starved by a series of synchronous - // updates. If that theory is correct, the proper solution is to fix the - // starvation. However, this scenario supports the idea that expiration - // times are an important safeguard when starvation does happen. - // - // Also note that, in the case of user input specifically, this will soon no - // longer be an issue because we plan to make user input synchronous by - // default (until you enter `startTransition`, of course.) - // - // If weren't planning to make these updates synchronous soon anyway, I - // would probably make this number a configurable parameter. - return currentTime + 250; - } else if (priority >= TransitionPriority) { - return currentTime + 5000; - } else { - // Anything idle priority or lower should never expire. - return NoTimestamp; + case DefaultHydrationLane: + case DefaultLane: + case TransitionHydrationLane: + case TransitionLane1: + case TransitionLane2: + case TransitionLane3: + case TransitionLane4: + case TransitionLane5: + case TransitionLane6: + case TransitionLane7: + case TransitionLane8: + case TransitionLane9: + case TransitionLane10: + case TransitionLane11: + case TransitionLane12: + case TransitionLane13: + case TransitionLane14: + case TransitionLane15: + case TransitionLane16: + case RetryLane1: + case RetryLane2: + case RetryLane3: + case RetryLane4: + case RetryLane5: + return currentTime + 5000; + + case SelectiveHydrationLane: + case IdleHydrationLane: + case IdleLane: + case OffscreenLane: + // Anything idle priority or lower should never expire. + return NoTimestamp; + + default: + { + error("Should have found matching lanes. This is a bug in React."); + } + + return NoTimestamp; } } @@ -4681,6 +4471,7 @@ function markStarvedLanesAsExpired(root, currentTime) { // it as expired to force it to finish. var lanes = pendingLanes; + var expiredLanes = 0; while (lanes > 0) { var index = pickArbitraryLaneIndex(lanes); @@ -4700,11 +4491,15 @@ function markStarvedLanesAsExpired(root, currentTime) { } } else if (expirationTime <= currentTime) { // This lane expired - root.expiredLanes |= lane; + expiredLanes |= lane; } lanes &= ~lane; } + + if (expiredLanes !== 0) { + markRootExpired(root, expiredLanes); + } } // This returns the highest priority pending lanes regardless of whether they function getLanesToRetrySynchronouslyOnError(root) { var everythingButOffscreen = root.pendingLanes & ~OffscreenLane; @@ -4719,9 +4514,6 @@ function getLanesToRetrySynchronouslyOnError(root) { return NoLanes; } -function returnNextLanesPriority() { - return return_highestLanePriority; -} function includesNonIdleWork(lanes) { return (lanes & NonIdleLanes) !== NoLanes; } @@ -4733,44 +4525,6 @@ function includesOnlyTransitions(lanes) { } function isTransitionLane(lane) { return (lane & TransitionLanes) !== 0; -} // To ensure consistency across multiple updates in the same event, this should -// be a pure function, so that it always returns the same lane for given inputs. - -function findUpdateLane(lanePriority) { - switch (lanePriority) { - case NoLanePriority: - break; - - case SyncLanePriority: - return SyncLane; - - case SyncBatchedLanePriority: - return SyncBatchedLane; - - case InputDiscreteLanePriority: - return SyncLane; - - case InputContinuousLanePriority: - return InputContinuousLane; - - case DefaultLanePriority: - return DefaultLane; - - case TransitionPriority: // Should be handled by findTransitionLane instead - - case RetryLanePriority: - // Should be handled by findRetryLane instead - break; - - case IdleLanePriority: - return IdleLane; - } - - { - throw Error( - "Invalid update priority: " + lanePriority + ". This is a bug in React." - ); - } } function claimNextTransitionLane() { // Cycle through the lanes, assigning each new transition to the next lane. @@ -4795,11 +4549,9 @@ function claimNextRetryLane() { return lane; } - function getHighestPriorityLane(lanes) { return lanes & -lanes; } - function pickArbitraryLane(lanes) { // This wrapper function gets inlined. Only exists so to communicate that it // doesn't matter which bit is selected; you can pick any bit without @@ -4836,9 +4588,6 @@ function intersectLanes(a, b) { function laneToLanes(lane) { return lane; } -function higherLanePriority(a, b) { - return a !== NoLanePriority && a > b ? a : b; -} function createLaneMap(initial) { // Intentionally pushing one by one. // https://v8.dev/blog/elements-kinds#avoid-creating-holes @@ -4893,7 +4642,16 @@ function markRootPinged(root, pingedLanes, eventTime) { root.pingedLanes |= root.suspendedLanes & pingedLanes; } function markRootExpired(root, expiredLanes) { - root.expiredLanes |= expiredLanes & root.pendingLanes; + var entanglements = root.entanglements; + var SyncLaneIndex = 0; + entanglements[SyncLaneIndex] |= expiredLanes; + root.entangledLanes |= SyncLane; + root.pendingLanes |= SyncLane; +} +function areLanesExpired(root, lanes) { + var SyncLaneIndex = 0; + var entanglements = root.entanglements; + return (entanglements[SyncLaneIndex] & lanes) !== NoLanes; } function markRootMutableRead(root, updateLane) { root.mutableReadLanes |= updateLane & root.pendingLanes; @@ -4904,7 +4662,6 @@ function markRootFinished(root, remainingLanes) { root.suspendedLanes = 0; root.pingedLanes = 0; - root.expiredLanes &= remainingLanes; root.mutableReadLanes &= remainingLanes; root.entangledLanes &= remainingLanes; @@ -4969,25 +4726,40 @@ function clz32Fallback(lanes) { return (31 - ((log(lanes) / LN2) | 0)) | 0; } -// Intentionally not named imports because Rollup would use dynamic dispatch for -var Scheduler_now$1 = Scheduler.unstable_now; +var DiscreteEventPriority = SyncLane; +var ContinuousEventPriority = InputContinuousLane; +var DefaultEventPriority = DefaultLane; +var IdleEventPriority = IdleLane; +var currentUpdatePriority = NoLane; +function getCurrentUpdatePriority() { + return currentUpdatePriority; +} +function setCurrentUpdatePriority(newPriority) { + currentUpdatePriority = newPriority; +} +function higherEventPriority(a, b) { + return a !== 0 && a < b ? a : b; +} +function isHigherEventPriority(a, b) { + return a !== 0 && a < b; +} +function lanesToEventPriority(lanes) { + var lane = getHighestPriorityLane(lanes); -{ - // Provide explicit error message when production+profiling bundle of e.g. - // react-dom is used with production (non-profiling) bundle of - // scheduler/tracing - if ( - !( - tracing.__interactionsRef != null && - tracing.__interactionsRef.current != null - ) - ) { - throw Error( - "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at https://reactjs.org/link/profiling" - ); + if (!isHigherEventPriority(DiscreteEventPriority, lane)) { + return DiscreteEventPriority; } + + if (!isHigherEventPriority(ContinuousEventPriority, lane)) { + return ContinuousEventPriority; + } + + if (includesNonIdleWork(lane)) { + return DefaultEventPriority; + } + + return IdleEventPriority; } -var initialTimeMs$1 = Scheduler_now$1(); // If the initial timestamp is reasonably small, use Scheduler's `now` directly. // can re-export everything from this module. @@ -5003,7 +4775,6 @@ var isSuspenseInstanceFallback = shim; var hydrateTextInstance = shim; var errorHydratingContainer = shim; -var DefaultLanePriority$1 = DefaultLanePriority; var getViewConfigForType = ReactNativePrivateInterface.ReactNativeViewConfigRegistry.get; var UPDATE_SIGNAL = {}; @@ -5180,7 +4951,7 @@ function shouldSetTextContent(type, props) { return false; } function getCurrentEventPriority() { - return DefaultLanePriority$1; + return DefaultEventPriority; } // ------------------- function appendChild(parentInstance, child) { var childTag = typeof child === "number" ? child : child._nativeTag; @@ -6011,6 +5782,33 @@ function findCurrentUnmaskedContext(fiber) { var LegacyRoot = 0; var ConcurrentRoot = 1; +// This module only exists as an ESM wrapper around the external CommonJS +var scheduleCallback = Scheduler.unstable_scheduleCallback; +var cancelCallback = Scheduler.unstable_cancelCallback; +var shouldYield = Scheduler.unstable_shouldYield; +var requestPaint = Scheduler.unstable_requestPaint; +var now = Scheduler.unstable_now; +var ImmediatePriority = Scheduler.unstable_ImmediatePriority; +var UserBlockingPriority = Scheduler.unstable_UserBlockingPriority; +var NormalPriority = Scheduler.unstable_NormalPriority; +var IdlePriority = Scheduler.unstable_IdlePriority; + +{ + // Provide explicit error message when production+profiling bundle of e.g. + // react-dom is used with production (non-profiling) bundle of + // scheduler/tracing + if ( + !( + tracing.__interactionsRef != null && + tracing.__interactionsRef.current != null + ) + ) { + throw Error( + "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at https://reactjs.org/link/profiling" + ); + } +} + var rendererID = null; var injectedHook = null; var hasLoggedError = false; @@ -6073,16 +5871,36 @@ function onScheduleRoot(root, children) { } } } -function onCommitRoot(root, priorityLevel) { +function onCommitRoot(root, eventPriority) { if (injectedHook && typeof injectedHook.onCommitFiberRoot === "function") { try { var didError = (root.current.flags & DidCapture) === DidCapture; if (enableProfilerTimer) { - var schedulerPriority = - priorityLevel === NoLanePriority - ? NormalPriority - : lanePriorityToSchedulerPriority(priorityLevel); + var schedulerPriority; + + switch (eventPriority) { + case DiscreteEventPriority: + schedulerPriority = ImmediatePriority; + break; + + case ContinuousEventPriority: + schedulerPriority = UserBlockingPriority; + break; + + case DefaultEventPriority: + schedulerPriority = NormalPriority; + break; + + case IdleEventPriority: + schedulerPriority = IdlePriority; + break; + + default: + schedulerPriority = NormalPriority; + break; + } + injectedHook.onCommitFiberRoot( rendererID, root, @@ -6119,6 +5937,59 @@ function onCommitUnmount(fiber) { } } +var syncQueue = null; +var isFlushingSyncQueue = false; +function scheduleSyncCallback(callback) { + // Push this callback into an internal queue. We'll flush these either in + // the next tick, or earlier if something calls `flushSyncCallbackQueue`. + if (syncQueue === null) { + syncQueue = [callback]; + } else { + // Push onto existing queue. Don't need to schedule a callback because + // we already scheduled one when we created the queue. + syncQueue.push(callback); + } +} +function flushSyncCallbackQueue() { + if (!isFlushingSyncQueue && syncQueue !== null) { + // Prevent re-entrancy. + isFlushingSyncQueue = true; + var i = 0; + var previousUpdatePriority = getCurrentUpdatePriority(); + + try { + var isSync = true; + var queue = syncQueue; // TODO: Is this necessary anymore? The only user code that runs in this + // queue is in the render or commit phases. + + setCurrentUpdatePriority(DiscreteEventPriority); + + for (; i < queue.length; i++) { + var callback = queue[i]; + + do { + callback = callback(isSync); + } while (callback !== null); + } + + syncQueue = null; + } catch (error) { + // If something throws, leave the remaining callbacks on the queue. + if (syncQueue !== null) { + syncQueue = syncQueue.slice(i + 1); + } // Resume flushing in the next tick + + scheduleCallback(ImmediatePriority, flushSyncCallbackQueue); + throw error; + } finally { + setCurrentUpdatePriority(previousUpdatePriority); + isFlushingSyncQueue = false; + } + } + + return null; +} + var NoFlags$1 = /* */ 0; // Represents whether effect should fire. @@ -6136,10 +6007,10 @@ var Passive$1 = // TODO: this is special because it gets imported during build. // -// TODO: 17.0.2 has not been released to NPM; +// TODO: 17.0.3 has not been released to NPM; // It exists as a placeholder so that DevTools can support work tag changes between releases. -// When we next publish a release (either 17.0.2 or 17.1.0), update the matching TODO in backend/renderer.js -var ReactVersion = "17.0.2"; +// When we next publish a release (either 17.0.3 or 17.1.0), update the matching TODO in backend/renderer.js +var ReactVersion = "17.0.3"; var NoMode = /* */ @@ -11571,15 +11442,11 @@ function rerenderDeferredValue(value) { } function startTransition(setPending, callback) { - var previousLanePriority = getCurrentUpdateLanePriority(); - setCurrentUpdateLanePriority( - higherLanePriority(previousLanePriority, InputContinuousLanePriority) + var previousPriority = getCurrentUpdatePriority(); + setCurrentUpdatePriority( + higherEventPriority(previousPriority, ContinuousEventPriority) ); - setPending(true); // TODO: Can remove this. Was only necessary because we used to give - // different behavior to transitions without a config object. Now they are - // all treated the same. - - setCurrentUpdateLanePriority(DefaultLanePriority); + setPending(true); var prevTransition = ReactCurrentBatchConfig$1.transition; ReactCurrentBatchConfig$1.transition = 1; @@ -11587,7 +11454,7 @@ function startTransition(setPending, callback) { setPending(false); callback(); } finally { - setCurrentUpdateLanePriority(previousLanePriority); + setCurrentUpdatePriority(previousPriority); ReactCurrentBatchConfig$1.transition = prevTransition; } } @@ -17600,12 +17467,7 @@ function commitDetachRef(current) { // deletion, so don't let them throw. Host-originating errors should // interrupt deletion, so it's okay -function commitUnmount( - finishedRoot, - current, - nearestMountedAncestor, - renderPriorityLevel -) { +function commitUnmount(finishedRoot, current, nearestMountedAncestor) { onCommitUnmount(current); switch (current.tag) { @@ -17684,12 +17546,7 @@ function commitUnmount( } } -function commitNestedUnmounts( - finishedRoot, - root, - nearestMountedAncestor, - renderPriorityLevel -) { +function commitNestedUnmounts(finishedRoot, root, nearestMountedAncestor) { // While we're inside a removed host node we don't want to call // removeChild on the inner nodes because they're removed by the top // call anyway. We also want to call componentWillUnmount on all @@ -17745,25 +17602,39 @@ function detachFiberMutation(fiber) { // Don't reset the alternate yet, either. We need that so we can detach the // alternate's fields in the passive phase. Clearing the return pointer is // sufficient for findDOMNode semantics. + var alternate = fiber.alternate; + + if (alternate !== null) { + alternate.return = null; + } + fiber.return = null; } function detachFiberAfterEffects(fiber) { - // Null out fields to improve GC for references that may be lingering (e.g. DevTools). - // Note that we already cleared the return pointer in detachFiberMutation(). - fiber.alternate = null; - fiber.child = null; - fiber.deletions = null; - fiber.dependencies = null; - fiber.memoizedProps = null; - fiber.memoizedState = null; - fiber.pendingProps = null; - fiber.sibling = null; - fiber.stateNode = null; - fiber.updateQueue = null; + var alternate = fiber.alternate; + + if (alternate !== null) { + fiber.alternate = null; + detachFiberAfterEffects(alternate); + } // Note: Defensively using negation instead of < in case + // `deletedTreeCleanUpLevel` is undefined. { - fiber._debugOwner = null; + // This is the default branch (level 0). + fiber.child = null; + fiber.deletions = null; + fiber.dependencies = null; + fiber.memoizedProps = null; + fiber.memoizedState = null; + fiber.pendingProps = null; + fiber.sibling = null; + fiber.stateNode = null; + fiber.updateQueue = null; + + { + fiber._debugOwner = null; + } } } @@ -17944,12 +17815,7 @@ function insertOrAppendPlacementNode(node, before, parent) { } } -function unmountHostComponents( - finishedRoot, - current, - nearestMountedAncestor, - renderPriorityLevel -) { +function unmountHostComponents(finishedRoot, current, nearestMountedAncestor) { // We only have the top Fiber that was deleted but we need to recurse down its // children to find all the terminal nodes. var node = current; // Each iteration, currentParent is populated with node's host parent if not @@ -18049,24 +17915,14 @@ function unmountHostComponents( } } -function commitDeletion( - finishedRoot, - current, - nearestMountedAncestor, - renderPriorityLevel -) { +function commitDeletion(finishedRoot, current, nearestMountedAncestor) { { // Recursively delete all host nodes from the parent. // Detach refs and call componentWillUnmount() on the whole subtree. unmountHostComponents(finishedRoot, current, nearestMountedAncestor); } - var alternate = current.alternate; detachFiberMutation(current); - - if (alternate !== null) { - detachFiberMutation(alternate); - } } function commitWork(current, finishedWork) { @@ -18251,12 +18107,12 @@ function commitResetTextContent(current) { resetTextContent(current.stateNode); } -function commitMutationEffects(root, renderPriorityLevel, firstChild) { +function commitMutationEffects(root, firstChild) { nextEffect = firstChild; - commitMutationEffects_begin(root, renderPriorityLevel); + commitMutationEffects_begin(root); } -function commitMutationEffects_begin(root, renderPriorityLevel) { +function commitMutationEffects_begin(root) { while (nextEffect !== null) { var fiber = nextEffect; // TODO: Should wrap this in flags check, too, as optimization @@ -18273,8 +18129,7 @@ function commitMutationEffects_begin(root, renderPriorityLevel) { null, root, childToDelete, - fiber, - renderPriorityLevel + fiber ); if (hasCaughtError()) { @@ -18291,12 +18146,12 @@ function commitMutationEffects_begin(root, renderPriorityLevel) { ensureCorrectReturnPointer(child, fiber); nextEffect = child; } else { - commitMutationEffects_complete(root, renderPriorityLevel); + commitMutationEffects_complete(root); } } } -function commitMutationEffects_complete(root, renderPriorityLevel) { +function commitMutationEffects_complete(root) { while (nextEffect !== null) { var fiber = nextEffect; @@ -18307,8 +18162,7 @@ function commitMutationEffects_complete(root, renderPriorityLevel) { commitMutationEffectsOnFiber, null, fiber, - root, - renderPriorityLevel + root ); if (hasCaughtError()) { @@ -18331,7 +18185,7 @@ function commitMutationEffects_complete(root, renderPriorityLevel) { } } -function commitMutationEffectsOnFiber(finishedWork, root, renderPriorityLevel) { +function commitMutationEffectsOnFiber(finishedWork, root) { var flags = finishedWork.flags; if (flags & ContentReset) { @@ -18553,13 +18407,35 @@ function commitPassiveUnmountEffects_begin() { commitPassiveUnmountEffectsInsideOfDeletedTree_begin( fiberToDelete, fiber - ); // Now that passive effects have been processed, it's safe to detach lingering pointers. - - var alternate = fiberToDelete.alternate; - detachFiberAfterEffects(fiberToDelete); + ); + } - if (alternate !== null) { - detachFiberAfterEffects(alternate); + { + // A fiber was deleted from this parent fiber, but it's still part of + // the previous (alternate) parent fiber's list of children. Because + // children are a linked list, an earlier sibling that's still alive + // will be connected to the deleted fiber via its `alternate`: + // + // live fiber + // --alternate--> previous live fiber + // --sibling--> deleted fiber + // + // We can't disconnect `alternate` on nodes that haven't been deleted + // yet, but we can disconnect the `sibling` and `child` pointers. + var previousFiber = fiber.alternate; + + if (previousFiber !== null) { + var detachedChild = previousFiber.child; + + if (detachedChild !== null) { + previousFiber.child = null; + + do { + var detachedSibling = detachedChild.sibling; + detachedChild.sibling = null; + detachedChild = detachedSibling; + } while (detachedChild !== null); + } } } @@ -18627,7 +18503,8 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin( setCurrentFiber(fiber); commitPassiveUnmountInsideDeletedTreeOnFiber(fiber, nearestMountedAncestor); resetCurrentFiber(); - var child = fiber.child; // TODO: Only traverse subtree if it has a PassiveStatic flag + var child = fiber.child; // TODO: Only traverse subtree if it has a PassiveStatic flag. (But, if we + // do this, still need to handle `deletedTreeCleanUpLevel` correctly.) if (child !== null) { ensureCorrectReturnPointer(child, fiber); @@ -18645,21 +18522,26 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_complete( ) { while (nextEffect !== null) { var fiber = nextEffect; + var sibling = fiber.sibling; + var returnFiber = fiber.return; - if (fiber === deletedSubtreeRoot) { - nextEffect = null; - return; + { + // This is the default branch (level 0). We do not recursively clear all + // the fiber fields. Only the root of the deleted subtree. + if (fiber === deletedSubtreeRoot) { + detachFiberAfterEffects(fiber); + nextEffect = null; + return; + } } - var sibling = fiber.sibling; - if (sibling !== null) { - ensureCorrectReturnPointer(sibling, fiber.return); + ensureCorrectReturnPointer(sibling, returnFiber); nextEffect = sibling; return; } - nextEffect = fiber.return; + nextEffect = returnFiber; } } @@ -18797,7 +18679,6 @@ var firstUncaughtError = null; var legacyErrorBoundariesThatAlreadyFailed = null; // Only used when enableProfilerNestedUpdateScheduledHook is true; var rootDoesHavePassiveEffects = false; var rootWithPendingPassiveEffects = null; -var pendingPassiveEffectsRenderPriority = NoLanePriority; var pendingPassiveEffectsLanes = NoLanes; var NESTED_UPDATE_LIMIT = 50; @@ -18842,32 +18723,44 @@ function requestUpdateLane(fiber) { if ((mode & ConcurrentMode) === NoMode) { return SyncLane; - } else if ((mode & ConcurrentMode) === NoMode) { - return getCurrentUpdateLanePriority() === SyncLanePriority - ? SyncLane - : SyncBatchedLane; - } // The algorithm for assigning an update to a lane should be stable for all + } var isTransition = requestCurrentTransition() !== NoTransition; if (isTransition) { + // The algorithm for assigning an update to a lane should be stable for all + // updates at the same priority within the same event. To do this, the + // inputs to the algorithm must be the same. + // + // The trick we use is to cache the first of each of these inputs within an + // 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) { + // All transitions within the same event are assigned the same lane. currentEventTransitionLane = claimNextTransitionLane(); } return currentEventTransitionLane; } // Updates originating inside certain React methods, like flushSync, have // their priority set by tracking it with a context variable. + // + // The opaque type returned by the host config is internally a lane, so we can + // use that directly. + // TODO: Move this type conversion to the event priority module. - var updateLanePriority = getCurrentUpdateLanePriority(); + var updateLane = getCurrentUpdatePriority(); - if (updateLanePriority !== NoLanePriority) { - return findUpdateLane(updateLanePriority); + if (updateLane !== NoLane) { + return updateLane; } // This update originated outside React. Ask the host environement for an // appropriate priority, based on the type of event. + // + // The opaque type returned by the host config is internally a lane, so we can + // use that directly. + // TODO: Move this type conversion to the event priority module. - var eventLanePriority = getCurrentEventPriority(); - return findUpdateLane(eventLanePriority); + var eventLane = getCurrentEventPriority(); + return eventLane; } function requestRetryLane(fiber) { @@ -18879,11 +18772,7 @@ function requestRetryLane(fiber) { if ((mode & ConcurrentMode) === NoMode) { return SyncLane; - } else if ((mode & ConcurrentMode) === NoMode) { - return getCurrentUpdateLanePriority() === SyncLanePriority - ? SyncLane - : SyncBatchedLane; - } // See `requestUpdateLane` for explanation of `currentEventWipLanes` + } return claimNextRetryLane(); } @@ -19039,9 +18928,7 @@ function ensureRootIsScheduled(root, currentTime) { var nextLanes = getNextLanes( root, root === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes - ); // This returns the priority level computed during the `getNextLanes` call. - - var newCallbackPriority = returnNextLanesPriority(); + ); if (nextLanes === NoLanes) { // Special case: There's nothing to work on. @@ -19050,9 +18937,11 @@ function ensureRootIsScheduled(root, currentTime) { } root.callbackNode = null; - root.callbackPriority = NoLanePriority; + root.callbackPriority = NoLane; return; - } // Check if there's an existing task. We may be able to reuse it. + } // We use the highest priority lane to represent the priority of the callback. + + var newCallbackPriority = getHighestPriorityLane(nextLanes); // Check if there's an existing task. We may be able to reuse it. var existingCallbackPriority = root.callbackPriority; @@ -19063,8 +18952,7 @@ function ensureRootIsScheduled(root, currentTime) { // TODO: Temporary until we confirm this warning is not fired. if ( existingCallbackNode == null && - existingCallbackPriority !== InputDiscreteLanePriority && - existingCallbackPriority !== SyncLanePriority + existingCallbackPriority !== SyncLane ) { error( "Expected scheduled callback to exist. This error is likely caused by a bug in React. Please file an issue." @@ -19082,7 +18970,7 @@ function ensureRootIsScheduled(root, currentTime) { var newCallbackNode; - if (newCallbackPriority === SyncLanePriority) { + if (newCallbackPriority === SyncLane) { // Special case: Sync React callbacks are scheduled on a special // internal queue scheduleSyncCallback(performSyncWorkOnRoot.bind(null, root)); @@ -19093,15 +18981,31 @@ function ensureRootIsScheduled(root, currentTime) { } newCallbackNode = null; - } else if (newCallbackPriority === SyncBatchedLanePriority) { - newCallbackNode = scheduleCallback( - ImmediatePriority, - performSyncWorkOnRoot.bind(null, root) - ); } else { - var schedulerPriorityLevel = lanePriorityToSchedulerPriority( - newCallbackPriority - ); + var schedulerPriorityLevel; + + switch (lanesToEventPriority(nextLanes)) { + case DiscreteEventPriority: + schedulerPriorityLevel = ImmediatePriority; + break; + + case ContinuousEventPriority: + schedulerPriorityLevel = UserBlockingPriority; + break; + + case DefaultEventPriority: + schedulerPriorityLevel = NormalPriority; + break; + + case IdleEventPriority: + schedulerPriorityLevel = IdlePriority; + break; + + default: + schedulerPriorityLevel = NormalPriority; + break; + } + newCallbackNode = scheduleCallback( schedulerPriorityLevel, performConcurrentWorkOnRoot.bind(null, root) @@ -19353,15 +19257,14 @@ function performSyncWorkOnRoot(root) { if ( root === workInProgressRoot && - includesSomeLane(root.expiredLanes, workInProgressRootRenderLanes) + areLanesExpired(root, workInProgressRootRenderLanes) ) { // There's a partial tree, and at least one of its lanes has expired. Finish // rendering it before rendering the rest of the expired work. lanes = workInProgressRootRenderLanes; exitStatus = renderRootSync(root, lanes); } else { - lanes = getNextLanes(root, NoLanes); // Because we don't cancel synchronous tasks, sometimes more than one - + lanes = getNextLanes(root, NoLanes); exitStatus = renderRootSync(root, lanes); } @@ -19406,7 +19309,7 @@ function performSyncWorkOnRoot(root) { ensureRootIsScheduled(root, now()); return null; -} +} // TODO: Do we still need this API? I think we can delete it. Was only used function batchedUpdates$1(fn, a) { var prevExecutionContext = executionContext; executionContext |= BatchedContext; @@ -19425,24 +19328,11 @@ function batchedUpdates$1(fn, a) { } function flushSync(fn, a) { var prevExecutionContext = executionContext; - - if ((prevExecutionContext & (RenderContext | CommitContext)) !== NoContext) { - { - error( - "flushSync was called from inside a lifecycle method. React cannot " + - "flush when React is already rendering. Consider moving this call to " + - "a scheduler task or micro task." - ); - } - - return fn(a); - } - executionContext |= BatchedContext; - var previousLanePriority = getCurrentUpdateLanePriority(); + var previousPriority = getCurrentUpdatePriority(); try { - setCurrentUpdateLanePriority(SyncLanePriority); + setCurrentUpdatePriority(DiscreteEventPriority); if (fn) { return fn(a); @@ -19450,12 +19340,22 @@ function flushSync(fn, a) { return undefined; } } finally { - setCurrentUpdateLanePriority(previousLanePriority); + setCurrentUpdatePriority(previousPriority); executionContext = prevExecutionContext; // Flush the immediate callbacks that were scheduled during this batch. // Note that this will happen even if batchedUpdates is higher up // the stack. - flushSyncCallbackQueue(); + if ((executionContext & (RenderContext | CommitContext)) === NoContext) { + flushSyncCallbackQueue(); + } else { + { + error( + "flushSync was called from inside a lifecycle method. React cannot " + + "flush when React is already rendering. Consider moving this call to " + + "a scheduler task or micro task." + ); + } + } } } function pushRenderLanes(fiber, lanes) { @@ -19883,13 +19783,15 @@ function completeUnitOfWork(unitOfWork) { } function commitRoot(root) { - var previousUpdateLanePriority = getCurrentUpdateLanePriority(); + // TODO: This no longer makes any sense. We already wrap the mutation and + // layout phases. Should be able to remove. + var previousUpdateLanePriority = getCurrentUpdatePriority(); try { - setCurrentUpdateLanePriority(SyncLanePriority); + setCurrentUpdatePriority(DiscreteEventPriority); commitRootImpl(root, previousUpdateLanePriority); } finally { - setCurrentUpdateLanePriority(previousUpdateLanePriority); + setCurrentUpdatePriority(previousUpdateLanePriority); } return null; @@ -19930,7 +19832,7 @@ function commitRootImpl(root, renderPriorityLevel) { // So we can clear these now to allow a new callback to be scheduled. root.callbackNode = null; - root.callbackPriority = NoLanePriority; // Update the first and last pending times on this root. The new first + root.callbackPriority = NoLane; // Update the first and last pending times on this root. The new first // pending time is whatever is left on the root fiber. var remainingLanes = mergeLanes(finishedWork.lanes, finishedWork.childLanes); @@ -19974,8 +19876,8 @@ function commitRootImpl(root, renderPriorityLevel) { NoFlags; if (subtreeHasEffects || rootHasEffect) { - var previousLanePriority = getCurrentUpdateLanePriority(); - setCurrentUpdateLanePriority(SyncLanePriority); + var previousPriority = getCurrentUpdatePriority(); + setCurrentUpdatePriority(DiscreteEventPriority); var prevExecutionContext = executionContext; executionContext |= CommitContext; var prevInteractions = pushInteractions(root); // Reset this to null before calling lifecycles @@ -19998,7 +19900,7 @@ function commitRootImpl(root, renderPriorityLevel) { recordCommitTime(); } - commitMutationEffects(root, renderPriorityLevel, finishedWork); + commitMutationEffects(root, finishedWork); resetAfterCommit(root.containerInfo); // The work-in-progress tree is now the current tree. This must come after // the mutation phase, so that the previous tree is still current during @@ -20016,12 +19918,9 @@ function commitRootImpl(root, renderPriorityLevel) { popInteractions(prevInteractions); } - executionContext = prevExecutionContext; + executionContext = prevExecutionContext; // Reset the priority to the previous non-sync value. - if (previousLanePriority != null) { - // Reset the priority to the previous non-sync value. - setCurrentUpdateLanePriority(previousLanePriority); - } + setCurrentUpdatePriority(previousPriority); } else { // No effects. root.current = finishedWork; // Measure these anyway so the flamegraph explicitly shows that there were @@ -20041,10 +19940,6 @@ function commitRootImpl(root, renderPriorityLevel) { rootDoesHavePassiveEffects = false; rootWithPendingPassiveEffects = root; pendingPassiveEffectsLanes = lanes; - pendingPassiveEffectsRenderPriority = - renderPriorityLevel === NoLanePriority - ? DefaultLanePriority - : renderPriorityLevel; } // Read this again, since an effect might have updated it remainingLanes = root.pendingLanes; // Check if there's remaining work on this root @@ -20122,19 +20017,18 @@ function commitRootImpl(root, renderPriorityLevel) { function flushPassiveEffects() { // Returns whether passive effects were flushed. - if (pendingPassiveEffectsRenderPriority !== NoLanePriority) { - var priorityLevel = - pendingPassiveEffectsRenderPriority > DefaultLanePriority - ? DefaultLanePriority - : pendingPassiveEffectsRenderPriority; - pendingPassiveEffectsRenderPriority = NoLanePriority; - var previousLanePriority = getCurrentUpdateLanePriority(); + if (pendingPassiveEffectsLanes !== NoLanes) { + var priority = higherEventPriority( + DefaultEventPriority, + lanesToEventPriority(pendingPassiveEffectsLanes) + ); + var previousPriority = getCurrentUpdatePriority(); try { - setCurrentUpdateLanePriority(priorityLevel); + setCurrentUpdatePriority(priority); return flushPassiveEffectsImpl(); } finally { - setCurrentUpdateLanePriority(previousLanePriority); + setCurrentUpdatePriority(previousPriority); } } @@ -22046,13 +21940,12 @@ function FiberRootNode(containerInfo, tag, hydrate) { this.pendingContext = null; this.hydrate = hydrate; this.callbackNode = null; - this.callbackPriority = NoLanePriority; + this.callbackPriority = NoLane; this.eventTimes = createLaneMap(NoLanes); this.expirationTimes = createLaneMap(NoTimestamp); this.pendingLanes = NoLanes; this.suspendedLanes = NoLanes; this.pingedLanes = NoLanes; - this.expiredLanes = NoLanes; this.mutableReadLanes = NoLanes; this.finishedLanes = NoLanes; this.entangledLanes = NoLanes; @@ -22758,23 +22651,25 @@ var getInspectorDataForViewAtPoint; } closestInstance = - internalInstanceHandle.stateNode.canonical._internalInstanceHandle; + internalInstanceHandle.stateNode.canonical._internalInstanceHandle; // Note: this is deprecated and we want to remove it ASAP. Keeping it here for React DevTools compatibility for now. + + var nativeViewTag = + internalInstanceHandle.stateNode.canonical._nativeTag; nativeFabricUIManager.measure( internalInstanceHandle.stateNode.node, function(x, y, width, height, pageX, pageY) { + var inspectorData = getInspectorDataForInstance(closestInstance); callback( - Object.assign( - { - pointerY: locationY, - frame: { - left: pageX, - top: pageY, - width: width, - height: height - } + Object.assign({}, inspectorData, { + pointerY: locationY, + frame: { + left: pageX, + top: pageY, + width: width, + height: height }, - getInspectorDataForInstance(closestInstance) - ) + touchedViewTag: nativeViewTag + }) ); } ); diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js b/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js index 6de9b44731a277..cf61e99d065c63 100644 --- a/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<9a93ce433eed65e2405523253a760a3a>> */ "use strict"; @@ -929,7 +929,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_215 = { +var injectedNamesToPlugins$jscomp$inline_217 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -964,34 +964,34 @@ var injectedNamesToPlugins$jscomp$inline_215 = { } } }, - isOrderingDirty$jscomp$inline_216 = !1, - pluginName$jscomp$inline_217; -for (pluginName$jscomp$inline_217 in injectedNamesToPlugins$jscomp$inline_215) + isOrderingDirty$jscomp$inline_218 = !1, + pluginName$jscomp$inline_219; +for (pluginName$jscomp$inline_219 in injectedNamesToPlugins$jscomp$inline_217) if ( - injectedNamesToPlugins$jscomp$inline_215.hasOwnProperty( - pluginName$jscomp$inline_217 + injectedNamesToPlugins$jscomp$inline_217.hasOwnProperty( + pluginName$jscomp$inline_219 ) ) { - var pluginModule$jscomp$inline_218 = - injectedNamesToPlugins$jscomp$inline_215[pluginName$jscomp$inline_217]; + var pluginModule$jscomp$inline_220 = + injectedNamesToPlugins$jscomp$inline_217[pluginName$jscomp$inline_219]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_217) || - namesToPlugins[pluginName$jscomp$inline_217] !== - pluginModule$jscomp$inline_218 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_219) || + namesToPlugins[pluginName$jscomp$inline_219] !== + pluginModule$jscomp$inline_220 ) { - if (namesToPlugins[pluginName$jscomp$inline_217]) + if (namesToPlugins[pluginName$jscomp$inline_219]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - pluginName$jscomp$inline_217 + + pluginName$jscomp$inline_219 + "`." ); namesToPlugins[ - pluginName$jscomp$inline_217 - ] = pluginModule$jscomp$inline_218; - isOrderingDirty$jscomp$inline_216 = !0; + pluginName$jscomp$inline_219 + ] = pluginModule$jscomp$inline_220; + isOrderingDirty$jscomp$inline_218 = !0; } } -isOrderingDirty$jscomp$inline_216 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_218 && recomputePluginOrdering(); var instanceCache = new Map(), instanceProps = new Map(); function getInstanceFromTag(tag) { @@ -1686,98 +1686,25 @@ var ReactNativeFiberHostComponent = (function() { }; return ReactNativeFiberHostComponent; })(), - Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback, - Scheduler_cancelCallback = Scheduler.unstable_cancelCallback, - Scheduler_shouldYield = Scheduler.unstable_shouldYield, - Scheduler_requestPaint = Scheduler.unstable_requestPaint, - Scheduler_now = Scheduler.unstable_now, - Scheduler_ImmediatePriority = Scheduler.unstable_ImmediatePriority, - Scheduler_UserBlockingPriority = Scheduler.unstable_UserBlockingPriority, - Scheduler_NormalPriority = Scheduler.unstable_NormalPriority, - Scheduler_LowPriority = Scheduler.unstable_LowPriority, - Scheduler_IdlePriority = Scheduler.unstable_IdlePriority, - requestPaint = - void 0 !== Scheduler_requestPaint ? Scheduler_requestPaint : function() {}, - syncQueue = null, - isFlushingSyncQueue = !1, - initialTimeMs = Scheduler_now(), - now = - 1e4 > initialTimeMs - ? Scheduler_now - : function() { - return Scheduler_now() - initialTimeMs; - }; -function reactPriorityToSchedulerPriority(reactPriorityLevel) { - switch (reactPriorityLevel) { - case 99: - return Scheduler_ImmediatePriority; - case 98: - return Scheduler_UserBlockingPriority; - case 97: - return Scheduler_NormalPriority; - case 96: - return Scheduler_LowPriority; - case 95: - return Scheduler_IdlePriority; - default: - throw Error("Unknown priority level."); - } -} -function scheduleCallback(reactPriorityLevel, callback, options) { - reactPriorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); - return Scheduler_scheduleCallback(reactPriorityLevel, callback, options); -} -function flushSyncCallbackQueue() { - if (!isFlushingSyncQueue && null !== syncQueue) { - isFlushingSyncQueue = !0; - var i = 0, - previousLanePriority = currentUpdateLanePriority; - try { - var queue = syncQueue; - for (currentUpdateLanePriority = 15; i < queue.length; i++) { - var callback = queue[i]; - do callback = callback(!0); - while (null !== callback); - } - syncQueue = null; - } catch (error) { - throw (null !== syncQueue && (syncQueue = syncQueue.slice(i + 1)), - Scheduler_scheduleCallback( - Scheduler_ImmediatePriority, - flushSyncCallbackQueue - ), - error); - } finally { - (currentUpdateLanePriority = previousLanePriority), - (isFlushingSyncQueue = !1); - } - } - return null; -} -var currentUpdateLanePriority = 0, - nextTransitionLane = 512, - nextRetryLane = 8388608, - return_highestLanePriority = 8; + nextTransitionLane = 64, + nextRetryLane = 4194304; function getHighestPriorityLanes(lanes) { switch (lanes & -lanes) { case 1: - return (return_highestLanePriority = 15), 1; + return 1; case 2: - return (return_highestLanePriority = 14), 2; + return 2; case 4: - return (return_highestLanePriority = 13), 4; + return 4; case 8: - return (return_highestLanePriority = 12), 8; + return 8; case 16: - return (return_highestLanePriority = 11), 16; + return 16; case 32: - return (return_highestLanePriority = 10), 32; + return 32; case 64: - return (return_highestLanePriority = 9), 64; case 128: - return (return_highestLanePriority = 8), 128; case 256: - return (return_highestLanePriority = 7), 256; case 512: case 1024: case 2048: @@ -1791,129 +1718,108 @@ function getHighestPriorityLanes(lanes) { case 524288: case 1048576: case 2097152: + return lanes & 4194240; case 4194304: - return (return_highestLanePriority = 6), lanes & 8388096; case 8388608: case 16777216: case 33554432: case 67108864: - return (return_highestLanePriority = 5), lanes & 125829120; + return lanes & 130023424; case 134217728: - return (return_highestLanePriority = 4), 134217728; + return 134217728; case 268435456: - return (return_highestLanePriority = 3), 268435456; + return 268435456; case 536870912: - return (return_highestLanePriority = 2), 536870912; + return 536870912; case 1073741824: - return (return_highestLanePriority = 1), 1073741824; + return 1073741824; default: - return (return_highestLanePriority = 8), lanes; - } -} -function lanePriorityToSchedulerPriority(lanePriority) { - switch (lanePriority) { - case 15: - case 14: - return 99; - case 13: - case 12: - case 11: - case 10: - return 98; - case 9: - case 8: - case 7: - case 6: - case 4: - case 5: - return 97; - case 3: - case 2: - case 1: - return 95; - case 0: - return 90; - default: - throw Error( - "Invalid update priority: " + lanePriority + ". This is a bug in React." - ); + return lanes; } } function getNextLanes(root, wipLanes) { var pendingLanes = root.pendingLanes; - if (0 === pendingLanes) return (return_highestLanePriority = 0); + if (0 === pendingLanes) return 0; var nextLanes = 0, - nextLanePriority = 0, - expiredLanes = root.expiredLanes, suspendedLanes = root.suspendedLanes, - pingedLanes = root.pingedLanes; - 0 !== expiredLanes - ? ((nextLanes = expiredLanes), - (nextLanePriority = return_highestLanePriority = 15)) - : ((expiredLanes = pendingLanes & 268435455), - 0 !== expiredLanes - ? ((pendingLanes = expiredLanes & ~suspendedLanes), - 0 !== pendingLanes - ? ((nextLanes = getHighestPriorityLanes(pendingLanes)), - (nextLanePriority = return_highestLanePriority)) - : ((pingedLanes &= expiredLanes), - 0 !== pingedLanes && - ((nextLanes = getHighestPriorityLanes(pingedLanes)), - (nextLanePriority = return_highestLanePriority)))) - : ((pendingLanes &= ~suspendedLanes), - 0 !== pendingLanes - ? ((nextLanes = getHighestPriorityLanes(pendingLanes)), - (nextLanePriority = return_highestLanePriority)) - : 0 !== pingedLanes && - ((nextLanes = getHighestPriorityLanes(pingedLanes)), - (nextLanePriority = return_highestLanePriority)))); + pingedLanes = root.pingedLanes, + nonIdlePendingLanes = pendingLanes & 268435455; + 0 !== nonIdlePendingLanes + ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), + 0 !== pendingLanes + ? (nextLanes = getHighestPriorityLanes(pendingLanes)) + : ((pingedLanes &= nonIdlePendingLanes), + 0 !== pingedLanes && + (nextLanes = getHighestPriorityLanes(pingedLanes)))) + : ((nonIdlePendingLanes = pendingLanes & ~suspendedLanes), + 0 !== nonIdlePendingLanes + ? (nextLanes = getHighestPriorityLanes(nonIdlePendingLanes)) + : 0 !== pingedLanes && + (nextLanes = getHighestPriorityLanes(pingedLanes))); if (0 === nextLanes) return 0; if ( 0 !== wipLanes && wipLanes !== nextLanes && - 0 === (wipLanes & suspendedLanes) - ) { - getHighestPriorityLanes(wipLanes); - suspendedLanes = return_highestLanePriority; - if ( - nextLanePriority <= suspendedLanes || - (8 === nextLanePriority && 6 === suspendedLanes) - ) - return wipLanes; - return_highestLanePriority = nextLanePriority; - } + 0 === (wipLanes & suspendedLanes) && + ((suspendedLanes = nextLanes & -nextLanes), + (pingedLanes = wipLanes & -wipLanes), + suspendedLanes >= pingedLanes || + (16 === suspendedLanes && 0 !== (pingedLanes & 4194240))) + ) + return wipLanes; wipLanes = root.entangledLanes; if (0 !== wipLanes) for (root = root.entanglements, wipLanes &= nextLanes; 0 < wipLanes; ) - (nextLanePriority = 31 - clz32(wipLanes)), - (suspendedLanes = 1 << nextLanePriority), - (nextLanes |= root[nextLanePriority]), - (wipLanes &= ~suspendedLanes); + (suspendedLanes = 31 - clz32(wipLanes)), + (pingedLanes = 1 << suspendedLanes), + (nextLanes |= root[suspendedLanes]), + (wipLanes &= ~pingedLanes); return nextLanes; } +function computeExpirationTime(lane, currentTime) { + switch (lane) { + case 1: + case 2: + case 4: + return currentTime + 250; + case 8: + case 16: + case 32: + case 64: + case 128: + case 256: + case 512: + case 1024: + case 2048: + case 4096: + case 8192: + case 16384: + case 32768: + case 65536: + case 131072: + case 262144: + case 524288: + case 1048576: + case 2097152: + case 4194304: + case 8388608: + case 16777216: + case 33554432: + case 67108864: + return currentTime + 5e3; + case 134217728: + case 268435456: + case 536870912: + case 1073741824: + return -1; + default: + return -1; + } +} function getLanesToRetrySynchronouslyOnError(root) { root = root.pendingLanes & -1073741825; return 0 !== root ? root : root & 1073741824 ? 1073741824 : 0; } -function findUpdateLane(lanePriority) { - switch (lanePriority) { - case 15: - return 1; - case 14: - return 2; - case 12: - return 1; - case 10: - return 32; - case 8: - return 128; - case 2: - return 536870912; - } - throw Error( - "Invalid update priority: " + lanePriority + ". This is a bug in React." - ); -} function createLaneMap(initial) { for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial); return laneMap; @@ -1926,12 +1832,16 @@ function markRootUpdated(root, updateLane, eventTime) { updateLane = 31 - clz32(updateLane); root[updateLane] = eventTime; } +function markRootExpired(root, expiredLanes) { + root.entanglements[0] |= expiredLanes; + root.entangledLanes |= 1; + root.pendingLanes |= 1; +} function markRootFinished(root, remainingLanes) { var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; root.pendingLanes = remainingLanes; root.suspendedLanes = 0; root.pingedLanes = 0; - root.expiredLanes &= remainingLanes; root.mutableReadLanes &= remainingLanes; root.entangledLanes &= remainingLanes; remainingLanes = root.entanglements; @@ -1961,8 +1871,17 @@ var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback, function clz32Fallback(lanes) { return 0 === lanes ? 32 : (31 - ((log(lanes) / LN2) | 0)) | 0; } -var Scheduler_now$1 = Scheduler.unstable_now; -Scheduler_now$1(); +var currentUpdatePriority = 0; +function lanesToEventPriority(lanes) { + lanes &= -lanes; + return 1 < lanes + ? 4 < lanes + ? 0 !== (lanes & 268435455) + ? 16 + : 536870912 + : 4 + : 1; +} function shim() { throw Error( "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." @@ -2107,7 +2026,16 @@ function invalidateContextProvider(workInProgress, type, didChange) { : pop(didPerformWorkStackCursor); push(didPerformWorkStackCursor, didChange); } -var rendererID = null, +var scheduleCallback = Scheduler.unstable_scheduleCallback, + cancelCallback = Scheduler.unstable_cancelCallback, + shouldYield = Scheduler.unstable_shouldYield, + requestPaint = Scheduler.unstable_requestPaint, + now = Scheduler.unstable_now, + ImmediatePriority = Scheduler.unstable_ImmediatePriority, + UserBlockingPriority = Scheduler.unstable_UserBlockingPriority, + NormalPriority = Scheduler.unstable_NormalPriority, + IdlePriority = Scheduler.unstable_IdlePriority, + rendererID = null, injectedHook = null; function onCommitRoot(root) { if (injectedHook && "function" === typeof injectedHook.onCommitFiberRoot) @@ -2120,6 +2048,32 @@ function onCommitRoot(root) { ); } catch (err) {} } +var syncQueue = null, + isFlushingSyncQueue = !1; +function flushSyncCallbackQueue() { + if (!isFlushingSyncQueue && null !== syncQueue) { + isFlushingSyncQueue = !0; + var i = 0, + previousUpdatePriority = currentUpdatePriority; + try { + var queue = syncQueue; + for (currentUpdatePriority = 1; i < queue.length; i++) { + var callback = queue[i]; + do callback = callback(!0); + while (null !== callback); + } + syncQueue = null; + } catch (error) { + throw (null !== syncQueue && (syncQueue = syncQueue.slice(i + 1)), + scheduleCallback(ImmediatePriority, flushSyncCallbackQueue), + error); + } finally { + (currentUpdatePriority = previousUpdatePriority), + (isFlushingSyncQueue = !1); + } + } + return null; +} var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; function is(x, y) { return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); @@ -2301,7 +2255,7 @@ function enqueueUpdate(fiber, update) { } function entangleTransitions(root, fiber, lane) { fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388096))) { + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 4194240))) { var queueLanes = fiber.lanes; queueLanes &= root.pendingLanes; lane |= queueLanes; @@ -3809,19 +3763,16 @@ function updateMemo(nextCreate, deps) { return nextCreate; } function startTransition(setPending, callback) { - var previousLanePriority = currentUpdateLanePriority; - currentUpdateLanePriority = - 0 !== previousLanePriority && 10 < previousLanePriority - ? previousLanePriority - : 10; + var previousPriority = currentUpdatePriority; + currentUpdatePriority = + 0 !== previousPriority && 4 > previousPriority ? previousPriority : 4; setPending(!0); - currentUpdateLanePriority = 8; var prevTransition = ReactCurrentBatchConfig$1.transition; ReactCurrentBatchConfig$1.transition = 1; try { setPending(!1), callback(); } finally { - (currentUpdateLanePriority = previousLanePriority), + (currentUpdatePriority = previousPriority), (ReactCurrentBatchConfig$1.transition = prevTransition); } } @@ -3877,7 +3828,7 @@ function dispatchAction(fiber, queue, action) { } finally { } update = scheduleUpdateOnFiber(fiber, lane, eventTime); - 0 !== (lane & 8388096) && + 0 !== (lane & 4194240) && null !== update && ((fiber = queue.lanes), (fiber &= update.pendingLanes), @@ -4597,7 +4548,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - (workInProgress.lanes = 8388608), + (workInProgress.lanes = 4194304), current ); renderLanes = createFiberFromOffscreen( @@ -5218,7 +5169,7 @@ function completeWork(current, workInProgress, renderLanes) { ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(type, !1), - (workInProgress.lanes = 8388608)); + (workInProgress.lanes = 4194304)); } else { if (!newProps) @@ -5245,7 +5196,7 @@ function completeWork(current, workInProgress, renderLanes) { ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(type, !1), - (workInProgress.lanes = 8388608)); + (workInProgress.lanes = 4194304)); type.isBackwards ? ((updatePayload.sibling = workInProgress.child), (workInProgress.child = updatePayload)) @@ -5667,7 +5618,9 @@ function commitUnmount(finishedRoot, current, nearestMountedAncestor$jscomp$0) { } } function detachFiberAfterEffects(fiber) { - fiber.alternate = null; + var alternate = fiber.alternate; + null !== alternate && + ((fiber.alternate = null), detachFiberAfterEffects(alternate)); fiber.child = null; fiber.deletions = null; fiber.dependencies = null; @@ -6030,32 +5983,32 @@ function attachSuspenseRetryListeners(finishedWork) { }); } } -function commitMutationEffects(root, renderPriorityLevel, firstChild) { +function commitMutationEffects(root, firstChild) { for (nextEffect = firstChild; null !== nextEffect; ) { - renderPriorityLevel = nextEffect; - firstChild = renderPriorityLevel.deletions; - if (null !== firstChild) - for (var i = 0; i < firstChild.length; i++) { - var childToDelete = firstChild[i]; + firstChild = nextEffect; + var deletions = firstChild.deletions; + if (null !== deletions) + for (var i = 0; i < deletions.length; i++) { + var childToDelete = deletions[i]; try { - unmountHostComponents(root, childToDelete, renderPriorityLevel); + unmountHostComponents(root, childToDelete, firstChild); var alternate = childToDelete.alternate; - childToDelete.return = null; null !== alternate && (alternate.return = null); + childToDelete.return = null; } catch (error) { - captureCommitPhaseError(childToDelete, renderPriorityLevel, error); + captureCommitPhaseError(childToDelete, firstChild, error); } } - firstChild = renderPriorityLevel.child; - if (0 !== (renderPriorityLevel.subtreeFlags & 6454) && null !== firstChild) - (firstChild.return = renderPriorityLevel), (nextEffect = firstChild); + deletions = firstChild.child; + if (0 !== (firstChild.subtreeFlags & 6454) && null !== deletions) + (deletions.return = firstChild), (nextEffect = deletions); else for (; null !== nextEffect; ) { - renderPriorityLevel = nextEffect; + firstChild = nextEffect; try { - var flags = renderPriorityLevel.flags; + var flags = firstChild.flags; if (flags & 256) { - var current = renderPriorityLevel.alternate; + var current = firstChild.alternate; if (null !== current) { var currentRef = current.ref; null !== currentRef && @@ -6066,38 +6019,34 @@ function commitMutationEffects(root, renderPriorityLevel, firstChild) { } switch (flags & 2054) { case 2: - commitPlacement(renderPriorityLevel); - renderPriorityLevel.flags &= -3; + commitPlacement(firstChild); + firstChild.flags &= -3; break; case 6: - commitPlacement(renderPriorityLevel); - renderPriorityLevel.flags &= -3; - commitWork(renderPriorityLevel.alternate, renderPriorityLevel); + commitPlacement(firstChild); + firstChild.flags &= -3; + commitWork(firstChild.alternate, firstChild); break; case 2048: - renderPriorityLevel.flags &= -2049; + firstChild.flags &= -2049; break; case 2052: - renderPriorityLevel.flags &= -2049; - commitWork(renderPriorityLevel.alternate, renderPriorityLevel); + firstChild.flags &= -2049; + commitWork(firstChild.alternate, firstChild); break; case 4: - commitWork(renderPriorityLevel.alternate, renderPriorityLevel); + commitWork(firstChild.alternate, firstChild); } } catch (error) { - captureCommitPhaseError( - renderPriorityLevel, - renderPriorityLevel.return, - error - ); + captureCommitPhaseError(firstChild, firstChild.return, error); } - firstChild = renderPriorityLevel.sibling; - if (null !== firstChild) { - firstChild.return = renderPriorityLevel.return; - nextEffect = firstChild; + deletions = firstChild.sibling; + if (null !== deletions) { + deletions.return = firstChild.return; + nextEffect = deletions; break; } - nextEffect = renderPriorityLevel.return; + nextEffect = firstChild.return; } } } @@ -6234,7 +6183,7 @@ var ceil = Math.ceil, legacyErrorBoundariesThatAlreadyFailed = null, rootDoesHavePassiveEffects = !1, rootWithPendingPassiveEffects = null, - pendingPassiveEffectsRenderPriority = 0, + pendingPassiveEffectsLanes = 0, nestedUpdateCount = 0, rootWithNestedUpdates = null, currentEventTime = -1, @@ -6247,20 +6196,18 @@ function requestEventTime() { : (currentEventTime = now()); } function requestUpdateLane(fiber) { - fiber = fiber.mode; - if (0 === (fiber & 1)) return 1; - if (0 === (fiber & 1)) return 15 === currentUpdateLanePriority ? 1 : 2; + if (0 === (fiber.mode & 1)) return 1; if (0 !== ReactCurrentBatchConfig.transition) return ( 0 === currentEventTransitionLane && ((fiber = nextTransitionLane), (nextTransitionLane <<= 1), - 0 === (nextTransitionLane & 8388096) && (nextTransitionLane = 512), + 0 === (nextTransitionLane & 4194240) && (nextTransitionLane = 64), (currentEventTransitionLane = fiber)), currentEventTransitionLane ); - fiber = currentUpdateLanePriority; - return 0 !== fiber ? findUpdateLane(fiber) : findUpdateLane(8); + fiber = currentUpdatePriority; + return 0 !== fiber ? fiber : 16; } function scheduleUpdateOnFiber(fiber, lane, eventTime) { if (50 < nestedUpdateCount) @@ -6306,7 +6253,8 @@ function ensureRootIsScheduled(root, currentTime) { suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes, expirationTimes = root.expirationTimes, - lanes = root.pendingLanes; + lanes = root.pendingLanes, + expiredLanes = 0; 0 < lanes; ) { @@ -6314,54 +6262,57 @@ function ensureRootIsScheduled(root, currentTime) { lane = 1 << index$6, expirationTime = expirationTimes[index$6]; if (-1 === expirationTime) { - if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) { - expirationTime = currentTime; - getHighestPriorityLanes(lane); - var priority = return_highestLanePriority; - expirationTimes[index$6] = - 10 <= priority - ? expirationTime + 250 - : 6 <= priority - ? expirationTime + 5e3 - : -1; - } - } else expirationTime <= currentTime && (root.expiredLanes |= lane); + if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) + expirationTimes[index$6] = computeExpirationTime(lane, currentTime); + } else expirationTime <= currentTime && (expiredLanes |= lane); lanes &= ~lane; } + 0 !== expiredLanes && markRootExpired(root, expiredLanes); suspendedLanes = getNextLanes( root, root === workInProgressRoot ? workInProgressRootRenderLanes : 0 ); - currentTime = return_highestLanePriority; - 0 === suspendedLanes - ? (null !== existingCallbackNode && - Scheduler_cancelCallback(existingCallbackNode), + if (0 === suspendedLanes) + null !== existingCallbackNode && cancelCallback(existingCallbackNode), (root.callbackNode = null), - (root.callbackPriority = 0)) - : root.callbackPriority !== currentTime && - (null != existingCallbackNode && - Scheduler_cancelCallback(existingCallbackNode), - 15 === currentTime - ? ((existingCallbackNode = performSyncWorkOnRoot.bind(null, root)), - null === syncQueue - ? (syncQueue = [existingCallbackNode]) - : syncQueue.push(existingCallbackNode), - scheduleCallback(99, flushSyncCallbackQueue), - (existingCallbackNode = null)) - : 14 === currentTime - ? (existingCallbackNode = scheduleCallback( - 99, - performSyncWorkOnRoot.bind(null, root) - )) - : ((existingCallbackNode = lanePriorityToSchedulerPriority( - currentTime - )), - (existingCallbackNode = scheduleCallback( - existingCallbackNode, - performConcurrentWorkOnRoot.bind(null, root) - ))), - (root.callbackPriority = currentTime), - (root.callbackNode = existingCallbackNode)); + (root.callbackPriority = 0); + else if ( + ((currentTime = suspendedLanes & -suspendedLanes), + root.callbackPriority !== currentTime) + ) { + null != existingCallbackNode && cancelCallback(existingCallbackNode); + if (1 === currentTime) + (existingCallbackNode = performSyncWorkOnRoot.bind(null, root)), + null === syncQueue + ? (syncQueue = [existingCallbackNode]) + : syncQueue.push(existingCallbackNode), + scheduleCallback(ImmediatePriority, flushSyncCallbackQueue), + (existingCallbackNode = null); + else { + switch (lanesToEventPriority(suspendedLanes)) { + case 1: + existingCallbackNode = ImmediatePriority; + break; + case 4: + existingCallbackNode = UserBlockingPriority; + break; + case 16: + existingCallbackNode = NormalPriority; + break; + case 536870912: + existingCallbackNode = IdlePriority; + break; + default: + existingCallbackNode = NormalPriority; + } + existingCallbackNode = scheduleCallback( + existingCallbackNode, + performConcurrentWorkOnRoot.bind(null, root) + ); + } + root.callbackPriority = currentTime; + root.callbackNode = existingCallbackNode; + } } function performConcurrentWorkOnRoot(root, didTimeout) { currentEventTime = -1; @@ -6378,9 +6329,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { if (0 === lanes) return null; if (didTimeout) return ( - (root.expiredLanes |= lanes & root.pendingLanes), - ensureRootIsScheduled(root, now()), - null + markRootExpired(root, lanes), ensureRootIsScheduled(root, now()), null ); didTimeout = lanes; var prevExecutionContext = executionContext; @@ -6432,7 +6381,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { case 3: markRootSuspended$1(root, lanes); if ( - (lanes & 125829120) === lanes && + (lanes & 130023424) === lanes && ((didTimeout = globalMostRecentFallbackTime + 500 - now()), 10 < didTimeout) ) { @@ -6453,7 +6402,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { break; case 4: markRootSuspended$1(root, lanes); - if ((lanes & 8388096) === lanes) break; + if ((lanes & 4194240) === lanes) break; didTimeout = root.eventTimes; for (prevExecutionContext = -1; 0 < lanes; ) { var index$5 = 31 - clz32(lanes); @@ -6515,11 +6464,10 @@ function performSyncWorkOnRoot(root) { if (0 !== (executionContext & 24)) throw Error("Should not already be working."); flushPassiveEffects(); - var lanes = - root === workInProgressRoot && - 0 !== (root.expiredLanes & workInProgressRootRenderLanes) - ? workInProgressRootRenderLanes - : getNextLanes(root, 0); + var lanes; + if ((lanes = root === workInProgressRoot)) + lanes = 0 !== (root.entanglements[0] & workInProgressRootRenderLanes); + lanes = lanes ? workInProgressRootRenderLanes : getNextLanes(root, 0); var exitStatus = renderRootSync(root, lanes); 0 !== root.tag && 2 === exitStatus && @@ -6832,7 +6780,7 @@ function workLoopSync() { for (; null !== workInProgress; ) performUnitOfWork(workInProgress); } function workLoopConcurrent() { - for (; null !== workInProgress && !Scheduler_shouldYield(); ) + for (; null !== workInProgress && !shouldYield(); ) performUnitOfWork(workInProgress); } function performUnitOfWork(unitOfWork) { @@ -6876,12 +6824,12 @@ function completeUnitOfWork(unitOfWork) { 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } function commitRoot(root) { - var previousUpdateLanePriority = currentUpdateLanePriority; + var previousUpdateLanePriority = currentUpdatePriority; try { - (currentUpdateLanePriority = 15), + (currentUpdatePriority = 1), commitRootImpl(root, previousUpdateLanePriority); } finally { - currentUpdateLanePriority = previousUpdateLanePriority; + currentUpdatePriority = previousUpdateLanePriority; } return null; } @@ -6910,30 +6858,29 @@ function commitRootImpl(root, renderPriorityLevel) { 0 === (finishedWork.flags & 1040)) || rootDoesHavePassiveEffects || ((rootDoesHavePassiveEffects = !0), - scheduleCallback(97, function() { + scheduleCallback(NormalPriority, function() { flushPassiveEffects(); return null; })); remainingLanes = 0 !== (finishedWork.flags & 8054); if (0 !== (finishedWork.subtreeFlags & 8054) || remainingLanes) { - remainingLanes = currentUpdateLanePriority; - currentUpdateLanePriority = 15; + remainingLanes = currentUpdatePriority; + currentUpdatePriority = 1; var prevExecutionContext = executionContext; executionContext |= 16; ReactCurrentOwner$2.current = null; commitBeforeMutationEffects(root, finishedWork); - commitMutationEffects(root, renderPriorityLevel, finishedWork); + commitMutationEffects(root, finishedWork); root.current = finishedWork; commitLayoutEffects(finishedWork, root, lanes); requestPaint(); executionContext = prevExecutionContext; - null != remainingLanes && (currentUpdateLanePriority = remainingLanes); + currentUpdatePriority = remainingLanes; } else root.current = finishedWork; rootDoesHavePassiveEffects && ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), - (pendingPassiveEffectsRenderPriority = - 0 === renderPriorityLevel ? 8 : renderPriorityLevel)); + (pendingPassiveEffectsLanes = lanes)); remainingLanes = root.pendingLanes; 0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null); 0 !== (remainingLanes & 1) @@ -6953,23 +6900,20 @@ function commitRootImpl(root, renderPriorityLevel) { return null; } function flushPassiveEffects() { - if (0 !== pendingPassiveEffectsRenderPriority) { - var priorityLevel = - 8 < pendingPassiveEffectsRenderPriority - ? 8 - : pendingPassiveEffectsRenderPriority; - pendingPassiveEffectsRenderPriority = 0; - var previousLanePriority = currentUpdateLanePriority; + if (0 !== pendingPassiveEffectsLanes) { + var b = lanesToEventPriority(pendingPassiveEffectsLanes), + previousPriority = currentUpdatePriority; try { - currentUpdateLanePriority = priorityLevel; + currentUpdatePriority = 16 < b ? 16 : b; if (null === rootWithPendingPassiveEffects) var JSCompiler_inline_result = !1; else { var root = rootWithPendingPassiveEffects; rootWithPendingPassiveEffects = null; + pendingPassiveEffectsLanes = 0; if (0 !== (executionContext & 24)) throw Error("Cannot flush passive effects while already rendering."); - priorityLevel = executionContext; + b = executionContext; executionContext |= 16; for (nextEffect = root.current; null !== nextEffect; ) { var fiber = nextEffect, @@ -6994,22 +6938,33 @@ function flushPassiveEffects() { else for (; null !== nextEffect; ) { fiber$jscomp$0 = nextEffect; + var sibling = fiber$jscomp$0.sibling, + returnFiber = fiber$jscomp$0.return; if (fiber$jscomp$0 === fiberToDelete) { + detachFiberAfterEffects(fiber$jscomp$0); nextEffect = null; break; } - var sibling = fiber$jscomp$0.sibling; if (null !== sibling) { - sibling.return = fiber$jscomp$0.return; + sibling.return = returnFiber; nextEffect = sibling; break; } - nextEffect = fiber$jscomp$0.return; + nextEffect = returnFiber; } } - var alternate = fiberToDelete.alternate; - detachFiberAfterEffects(fiberToDelete); - null !== alternate && detachFiberAfterEffects(alternate); + } + var previousFiber = fiber.alternate; + if (null !== previousFiber) { + var detachedChild = previousFiber.child; + if (null !== detachedChild) { + previousFiber.child = null; + do { + var detachedSibling = detachedChild.sibling; + detachedChild.sibling = null; + detachedChild = detachedSibling; + } while (null !== detachedChild); + } } nextEffect = fiber; } @@ -7068,13 +7023,13 @@ function flushPassiveEffects() { nextEffect = deletions.return; } } - executionContext = priorityLevel; + executionContext = b; flushSyncCallbackQueue(); JSCompiler_inline_result = !0; } return JSCompiler_inline_result; } finally { - currentUpdateLanePriority = previousLanePriority; + currentUpdatePriority = previousPriority; } } return !1; @@ -7144,7 +7099,7 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) { (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && (4 === workInProgressRootExitStatus || (3 === workInProgressRootExitStatus && - (workInProgressRootRenderLanes & 125829120) === + (workInProgressRootRenderLanes & 130023424) === workInProgressRootRenderLanes && 500 > now() - globalMostRecentFallbackTime) ? prepareFreshStack(root, 0) @@ -7156,14 +7111,11 @@ function resolveRetryWakeable(boundaryFiber, wakeable) { null !== retryCache && retryCache.delete(wakeable); wakeable = 0; 0 === wakeable && - ((wakeable = boundaryFiber.mode), - 0 === (wakeable & 1) + (0 === (boundaryFiber.mode & 1) ? (wakeable = 1) - : 0 === (wakeable & 1) - ? (wakeable = 15 === currentUpdateLanePriority ? 1 : 2) : ((wakeable = nextRetryLane), (nextRetryLane <<= 1), - 0 === (nextRetryLane & 125829120) && (nextRetryLane = 8388608))); + 0 === (nextRetryLane & 130023424) && (nextRetryLane = 4194304))); retryCache = requestEventTime(); boundaryFiber = markUpdateLaneFromFiberToRoot(boundaryFiber, wakeable); null !== boundaryFiber && @@ -7891,7 +7843,7 @@ function FiberRootNode(containerInfo, tag, hydrate) { this.callbackPriority = 0; this.eventTimes = createLaneMap(0); this.expirationTimes = createLaneMap(-1); - this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0; + this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0; this.entanglements = createLaneMap(0); } function createPortal(children, containerInfo, implementation) { @@ -8014,10 +7966,10 @@ batchedUpdatesImpl = function(fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_985 = { + devToolsConfig$jscomp$inline_984 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "17.0.2", + version: "17.0.3", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function() { @@ -8032,11 +7984,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1246 = { - bundleType: devToolsConfig$jscomp$inline_985.bundleType, - version: devToolsConfig$jscomp$inline_985.version, - rendererPackageName: devToolsConfig$jscomp$inline_985.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_985.rendererConfig, +var internals$jscomp$inline_1234 = { + bundleType: devToolsConfig$jscomp$inline_984.bundleType, + version: devToolsConfig$jscomp$inline_984.version, + rendererPackageName: devToolsConfig$jscomp$inline_984.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_984.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -8051,7 +8003,7 @@ var internals$jscomp$inline_1246 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_985.findFiberByHostInstance || + devToolsConfig$jscomp$inline_984.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, @@ -8060,16 +8012,16 @@ var internals$jscomp$inline_1246 = { getCurrentFiber: null }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1247 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1235 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1247.isDisabled && - hook$jscomp$inline_1247.supportsFiber + !hook$jscomp$inline_1235.isDisabled && + hook$jscomp$inline_1235.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1247.inject( - internals$jscomp$inline_1246 + (rendererID = hook$jscomp$inline_1235.inject( + internals$jscomp$inline_1234 )), - (injectedHook = hook$jscomp$inline_1247); + (injectedHook = hook$jscomp$inline_1235); } catch (err) {} } exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js b/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js index e34a5fb3c50409..d46043b8138766 100644 --- a/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<1a7d2241ef385ad3a6cbcb1476a22147>> */ "use strict"; @@ -930,7 +930,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_221 = { +var injectedNamesToPlugins$jscomp$inline_223 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -965,34 +965,34 @@ var injectedNamesToPlugins$jscomp$inline_221 = { } } }, - isOrderingDirty$jscomp$inline_222 = !1, - pluginName$jscomp$inline_223; -for (pluginName$jscomp$inline_223 in injectedNamesToPlugins$jscomp$inline_221) + isOrderingDirty$jscomp$inline_224 = !1, + pluginName$jscomp$inline_225; +for (pluginName$jscomp$inline_225 in injectedNamesToPlugins$jscomp$inline_223) if ( - injectedNamesToPlugins$jscomp$inline_221.hasOwnProperty( - pluginName$jscomp$inline_223 + injectedNamesToPlugins$jscomp$inline_223.hasOwnProperty( + pluginName$jscomp$inline_225 ) ) { - var pluginModule$jscomp$inline_224 = - injectedNamesToPlugins$jscomp$inline_221[pluginName$jscomp$inline_223]; + var pluginModule$jscomp$inline_226 = + injectedNamesToPlugins$jscomp$inline_223[pluginName$jscomp$inline_225]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_223) || - namesToPlugins[pluginName$jscomp$inline_223] !== - pluginModule$jscomp$inline_224 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_225) || + namesToPlugins[pluginName$jscomp$inline_225] !== + pluginModule$jscomp$inline_226 ) { - if (namesToPlugins[pluginName$jscomp$inline_223]) + if (namesToPlugins[pluginName$jscomp$inline_225]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - pluginName$jscomp$inline_223 + + pluginName$jscomp$inline_225 + "`." ); namesToPlugins[ - pluginName$jscomp$inline_223 - ] = pluginModule$jscomp$inline_224; - isOrderingDirty$jscomp$inline_222 = !0; + pluginName$jscomp$inline_225 + ] = pluginModule$jscomp$inline_226; + isOrderingDirty$jscomp$inline_224 = !0; } } -isOrderingDirty$jscomp$inline_222 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_224 && recomputePluginOrdering(); var instanceCache = new Map(), instanceProps = new Map(); function getInstanceFromTag(tag) { @@ -1687,105 +1687,25 @@ var ReactNativeFiberHostComponent = (function() { }; return ReactNativeFiberHostComponent; })(), - Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback, - Scheduler_cancelCallback = Scheduler.unstable_cancelCallback, - Scheduler_shouldYield = Scheduler.unstable_shouldYield, - Scheduler_requestPaint = Scheduler.unstable_requestPaint, - Scheduler_now = Scheduler.unstable_now, - Scheduler_ImmediatePriority = Scheduler.unstable_ImmediatePriority, - Scheduler_UserBlockingPriority = Scheduler.unstable_UserBlockingPriority, - Scheduler_NormalPriority = Scheduler.unstable_NormalPriority, - Scheduler_LowPriority = Scheduler.unstable_LowPriority, - Scheduler_IdlePriority = Scheduler.unstable_IdlePriority; -if ( - null == tracing.__interactionsRef || - null == tracing.__interactionsRef.current -) - throw Error( - "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at https://reactjs.org/link/profiling" - ); -var requestPaint = - void 0 !== Scheduler_requestPaint ? Scheduler_requestPaint : function() {}, - syncQueue = null, - isFlushingSyncQueue = !1, - initialTimeMs = Scheduler_now(), - now = - 1e4 > initialTimeMs - ? Scheduler_now - : function() { - return Scheduler_now() - initialTimeMs; - }; -function reactPriorityToSchedulerPriority(reactPriorityLevel) { - switch (reactPriorityLevel) { - case 99: - return Scheduler_ImmediatePriority; - case 98: - return Scheduler_UserBlockingPriority; - case 97: - return Scheduler_NormalPriority; - case 96: - return Scheduler_LowPriority; - case 95: - return Scheduler_IdlePriority; - default: - throw Error("Unknown priority level."); - } -} -function scheduleCallback(reactPriorityLevel, callback, options) { - reactPriorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); - return Scheduler_scheduleCallback(reactPriorityLevel, callback, options); -} -function flushSyncCallbackQueue() { - if (!isFlushingSyncQueue && null !== syncQueue) { - isFlushingSyncQueue = !0; - var i = 0, - previousLanePriority = currentUpdateLanePriority; - try { - var queue = syncQueue; - for (currentUpdateLanePriority = 15; i < queue.length; i++) { - var callback = queue[i]; - do callback = callback(!0); - while (null !== callback); - } - syncQueue = null; - } catch (error) { - throw (null !== syncQueue && (syncQueue = syncQueue.slice(i + 1)), - Scheduler_scheduleCallback( - Scheduler_ImmediatePriority, - flushSyncCallbackQueue - ), - error); - } finally { - (currentUpdateLanePriority = previousLanePriority), - (isFlushingSyncQueue = !1); - } - } - return null; -} -var currentUpdateLanePriority = 0, - nextTransitionLane = 512, - nextRetryLane = 8388608, - return_highestLanePriority = 8; + nextTransitionLane = 64, + nextRetryLane = 4194304; function getHighestPriorityLanes(lanes) { switch (lanes & -lanes) { case 1: - return (return_highestLanePriority = 15), 1; + return 1; case 2: - return (return_highestLanePriority = 14), 2; + return 2; case 4: - return (return_highestLanePriority = 13), 4; + return 4; case 8: - return (return_highestLanePriority = 12), 8; + return 8; case 16: - return (return_highestLanePriority = 11), 16; + return 16; case 32: - return (return_highestLanePriority = 10), 32; + return 32; case 64: - return (return_highestLanePriority = 9), 64; case 128: - return (return_highestLanePriority = 8), 128; case 256: - return (return_highestLanePriority = 7), 256; case 512: case 1024: case 2048: @@ -1799,129 +1719,108 @@ function getHighestPriorityLanes(lanes) { case 524288: case 1048576: case 2097152: + return lanes & 4194240; case 4194304: - return (return_highestLanePriority = 6), lanes & 8388096; case 8388608: case 16777216: case 33554432: case 67108864: - return (return_highestLanePriority = 5), lanes & 125829120; + return lanes & 130023424; case 134217728: - return (return_highestLanePriority = 4), 134217728; + return 134217728; case 268435456: - return (return_highestLanePriority = 3), 268435456; + return 268435456; case 536870912: - return (return_highestLanePriority = 2), 536870912; + return 536870912; case 1073741824: - return (return_highestLanePriority = 1), 1073741824; - default: - return (return_highestLanePriority = 8), lanes; - } -} -function lanePriorityToSchedulerPriority(lanePriority) { - switch (lanePriority) { - case 15: - case 14: - return 99; - case 13: - case 12: - case 11: - case 10: - return 98; - case 9: - case 8: - case 7: - case 6: - case 4: - case 5: - return 97; - case 3: - case 2: - case 1: - return 95; - case 0: - return 90; + return 1073741824; default: - throw Error( - "Invalid update priority: " + lanePriority + ". This is a bug in React." - ); + return lanes; } } function getNextLanes(root, wipLanes) { var pendingLanes = root.pendingLanes; - if (0 === pendingLanes) return (return_highestLanePriority = 0); + if (0 === pendingLanes) return 0; var nextLanes = 0, - nextLanePriority = 0, - expiredLanes = root.expiredLanes, suspendedLanes = root.suspendedLanes, - pingedLanes = root.pingedLanes; - 0 !== expiredLanes - ? ((nextLanes = expiredLanes), - (nextLanePriority = return_highestLanePriority = 15)) - : ((expiredLanes = pendingLanes & 268435455), - 0 !== expiredLanes - ? ((pendingLanes = expiredLanes & ~suspendedLanes), - 0 !== pendingLanes - ? ((nextLanes = getHighestPriorityLanes(pendingLanes)), - (nextLanePriority = return_highestLanePriority)) - : ((pingedLanes &= expiredLanes), - 0 !== pingedLanes && - ((nextLanes = getHighestPriorityLanes(pingedLanes)), - (nextLanePriority = return_highestLanePriority)))) - : ((pendingLanes &= ~suspendedLanes), - 0 !== pendingLanes - ? ((nextLanes = getHighestPriorityLanes(pendingLanes)), - (nextLanePriority = return_highestLanePriority)) - : 0 !== pingedLanes && - ((nextLanes = getHighestPriorityLanes(pingedLanes)), - (nextLanePriority = return_highestLanePriority)))); + pingedLanes = root.pingedLanes, + nonIdlePendingLanes = pendingLanes & 268435455; + 0 !== nonIdlePendingLanes + ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), + 0 !== pendingLanes + ? (nextLanes = getHighestPriorityLanes(pendingLanes)) + : ((pingedLanes &= nonIdlePendingLanes), + 0 !== pingedLanes && + (nextLanes = getHighestPriorityLanes(pingedLanes)))) + : ((nonIdlePendingLanes = pendingLanes & ~suspendedLanes), + 0 !== nonIdlePendingLanes + ? (nextLanes = getHighestPriorityLanes(nonIdlePendingLanes)) + : 0 !== pingedLanes && + (nextLanes = getHighestPriorityLanes(pingedLanes))); if (0 === nextLanes) return 0; if ( 0 !== wipLanes && wipLanes !== nextLanes && - 0 === (wipLanes & suspendedLanes) - ) { - getHighestPriorityLanes(wipLanes); - suspendedLanes = return_highestLanePriority; - if ( - nextLanePriority <= suspendedLanes || - (8 === nextLanePriority && 6 === suspendedLanes) - ) - return wipLanes; - return_highestLanePriority = nextLanePriority; - } + 0 === (wipLanes & suspendedLanes) && + ((suspendedLanes = nextLanes & -nextLanes), + (pingedLanes = wipLanes & -wipLanes), + suspendedLanes >= pingedLanes || + (16 === suspendedLanes && 0 !== (pingedLanes & 4194240))) + ) + return wipLanes; wipLanes = root.entangledLanes; if (0 !== wipLanes) for (root = root.entanglements, wipLanes &= nextLanes; 0 < wipLanes; ) - (nextLanePriority = 31 - clz32(wipLanes)), - (suspendedLanes = 1 << nextLanePriority), - (nextLanes |= root[nextLanePriority]), - (wipLanes &= ~suspendedLanes); + (suspendedLanes = 31 - clz32(wipLanes)), + (pingedLanes = 1 << suspendedLanes), + (nextLanes |= root[suspendedLanes]), + (wipLanes &= ~pingedLanes); return nextLanes; } +function computeExpirationTime(lane, currentTime) { + switch (lane) { + case 1: + case 2: + case 4: + return currentTime + 250; + case 8: + case 16: + case 32: + case 64: + case 128: + case 256: + case 512: + case 1024: + case 2048: + case 4096: + case 8192: + case 16384: + case 32768: + case 65536: + case 131072: + case 262144: + case 524288: + case 1048576: + case 2097152: + case 4194304: + case 8388608: + case 16777216: + case 33554432: + case 67108864: + return currentTime + 5e3; + case 134217728: + case 268435456: + case 536870912: + case 1073741824: + return -1; + default: + return -1; + } +} function getLanesToRetrySynchronouslyOnError(root) { root = root.pendingLanes & -1073741825; return 0 !== root ? root : root & 1073741824 ? 1073741824 : 0; } -function findUpdateLane(lanePriority) { - switch (lanePriority) { - case 15: - return 1; - case 14: - return 2; - case 12: - return 1; - case 10: - return 32; - case 8: - return 128; - case 2: - return 536870912; - } - throw Error( - "Invalid update priority: " + lanePriority + ". This is a bug in React." - ); -} function createLaneMap(initial) { for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial); return laneMap; @@ -1934,12 +1833,16 @@ function markRootUpdated(root, updateLane, eventTime) { updateLane = 31 - clz32(updateLane); root[updateLane] = eventTime; } +function markRootExpired(root, expiredLanes) { + root.entanglements[0] |= expiredLanes; + root.entangledLanes |= 1; + root.pendingLanes |= 1; +} function markRootFinished(root, remainingLanes) { var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; root.pendingLanes = remainingLanes; root.suspendedLanes = 0; root.pingedLanes = 0; - root.expiredLanes &= remainingLanes; root.mutableReadLanes &= remainingLanes; root.entangledLanes &= remainingLanes; remainingLanes = root.entanglements; @@ -1969,15 +1872,17 @@ var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback, function clz32Fallback(lanes) { return 0 === lanes ? 32 : (31 - ((log(lanes) / LN2) | 0)) | 0; } -var Scheduler_now$1 = Scheduler.unstable_now; -if ( - null == tracing.__interactionsRef || - null == tracing.__interactionsRef.current -) - throw Error( - "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at https://reactjs.org/link/profiling" - ); -Scheduler_now$1(); +var currentUpdatePriority = 0; +function lanesToEventPriority(lanes) { + lanes &= -lanes; + return 1 < lanes + ? 4 < lanes + ? 0 !== (lanes & 268435455) + ? 16 + : 536870912 + : 4 + : 1; +} function shim() { throw Error( "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." @@ -2122,17 +2027,45 @@ function invalidateContextProvider(workInProgress, type, didChange) { : pop(didPerformWorkStackCursor); push(didPerformWorkStackCursor, didChange); } +var scheduleCallback = Scheduler.unstable_scheduleCallback, + cancelCallback = Scheduler.unstable_cancelCallback, + shouldYield = Scheduler.unstable_shouldYield, + requestPaint = Scheduler.unstable_requestPaint, + now = Scheduler.unstable_now, + ImmediatePriority = Scheduler.unstable_ImmediatePriority, + UserBlockingPriority = Scheduler.unstable_UserBlockingPriority, + NormalPriority = Scheduler.unstable_NormalPriority, + IdlePriority = Scheduler.unstable_IdlePriority; +if ( + null == tracing.__interactionsRef || + null == tracing.__interactionsRef.current +) + throw Error( + "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at https://reactjs.org/link/profiling" + ); var rendererID = null, injectedHook = null, isDevToolsPresent = "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__; -function onCommitRoot(root, priorityLevel) { +function onCommitRoot(root, eventPriority) { if (injectedHook && "function" === typeof injectedHook.onCommitFiberRoot) try { - var didError = 128 === (root.current.flags & 128), - schedulerPriority = - 0 === priorityLevel - ? 97 - : lanePriorityToSchedulerPriority(priorityLevel); + var didError = 128 === (root.current.flags & 128); + switch (eventPriority) { + case 1: + var schedulerPriority = ImmediatePriority; + break; + case 4: + schedulerPriority = UserBlockingPriority; + break; + case 16: + schedulerPriority = NormalPriority; + break; + case 536870912: + schedulerPriority = IdlePriority; + break; + default: + schedulerPriority = NormalPriority; + } injectedHook.onCommitFiberRoot( rendererID, root, @@ -2141,6 +2074,32 @@ function onCommitRoot(root, priorityLevel) { ); } catch (err) {} } +var syncQueue = null, + isFlushingSyncQueue = !1; +function flushSyncCallbackQueue() { + if (!isFlushingSyncQueue && null !== syncQueue) { + isFlushingSyncQueue = !0; + var i = 0, + previousUpdatePriority = currentUpdatePriority; + try { + var queue = syncQueue; + for (currentUpdatePriority = 1; i < queue.length; i++) { + var callback = queue[i]; + do callback = callback(!0); + while (null !== callback); + } + syncQueue = null; + } catch (error) { + throw (null !== syncQueue && (syncQueue = syncQueue.slice(i + 1)), + scheduleCallback(ImmediatePriority, flushSyncCallbackQueue), + error); + } finally { + (currentUpdatePriority = previousUpdatePriority), + (isFlushingSyncQueue = !1); + } + } + return null; +} var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; function is(x, y) { return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); @@ -2322,7 +2281,7 @@ function enqueueUpdate(fiber, update) { } function entangleTransitions(root, fiber, lane) { fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388096))) { + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 4194240))) { var queueLanes = fiber.lanes; queueLanes &= root.pendingLanes; lane |= queueLanes; @@ -3830,19 +3789,16 @@ function updateMemo(nextCreate, deps) { return nextCreate; } function startTransition(setPending, callback) { - var previousLanePriority = currentUpdateLanePriority; - currentUpdateLanePriority = - 0 !== previousLanePriority && 10 < previousLanePriority - ? previousLanePriority - : 10; + var previousPriority = currentUpdatePriority; + currentUpdatePriority = + 0 !== previousPriority && 4 > previousPriority ? previousPriority : 4; setPending(!0); - currentUpdateLanePriority = 8; var prevTransition = ReactCurrentBatchConfig$1.transition; ReactCurrentBatchConfig$1.transition = 1; try { setPending(!1), callback(); } finally { - (currentUpdateLanePriority = previousLanePriority), + (currentUpdatePriority = previousPriority), (ReactCurrentBatchConfig$1.transition = prevTransition); } } @@ -3898,7 +3854,7 @@ function dispatchAction(fiber, queue, action) { } finally { } update = scheduleUpdateOnFiber(fiber, lane, eventTime); - 0 !== (lane & 8388096) && + 0 !== (lane & 4194240) && null !== update && ((fiber = queue.lanes), (fiber &= update.pendingLanes), @@ -4638,8 +4594,8 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - (workInProgress.lanes = 8388608), - markSpawnedWork(8388608), + (workInProgress.lanes = 4194304), + markSpawnedWork(4194304), current ); renderLanes = createFiberFromOffscreen( @@ -5319,8 +5275,8 @@ function completeWork(current, workInProgress, renderLanes) { ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(type, !1), - (workInProgress.lanes = 8388608), - markSpawnedWork(8388608)); + (workInProgress.lanes = 4194304), + markSpawnedWork(4194304)); } else { if (!newProps) @@ -5347,8 +5303,8 @@ function completeWork(current, workInProgress, renderLanes) { ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(type, !1), - (workInProgress.lanes = 8388608), - markSpawnedWork(8388608)); + (workInProgress.lanes = 4194304), + markSpawnedWork(4194304)); type.isBackwards ? ((updatePayload.sibling = workInProgress.child), (workInProgress.child = updatePayload)) @@ -5776,7 +5732,9 @@ function commitUnmount(finishedRoot, current, nearestMountedAncestor$jscomp$0) { } } function detachFiberAfterEffects(fiber) { - fiber.alternate = null; + var alternate = fiber.alternate; + null !== alternate && + ((fiber.alternate = null), detachFiberAfterEffects(alternate)); fiber.child = null; fiber.deletions = null; fiber.dependencies = null; @@ -6142,32 +6100,32 @@ function attachSuspenseRetryListeners(finishedWork) { }); } } -function commitMutationEffects(root, renderPriorityLevel, firstChild) { +function commitMutationEffects(root, firstChild) { for (nextEffect = firstChild; null !== nextEffect; ) { - renderPriorityLevel = nextEffect; - firstChild = renderPriorityLevel.deletions; - if (null !== firstChild) - for (var i = 0; i < firstChild.length; i++) { - var childToDelete = firstChild[i]; + firstChild = nextEffect; + var deletions = firstChild.deletions; + if (null !== deletions) + for (var i = 0; i < deletions.length; i++) { + var childToDelete = deletions[i]; try { - unmountHostComponents(root, childToDelete, renderPriorityLevel); + unmountHostComponents(root, childToDelete, firstChild); var alternate = childToDelete.alternate; - childToDelete.return = null; null !== alternate && (alternate.return = null); + childToDelete.return = null; } catch (error) { - captureCommitPhaseError(childToDelete, renderPriorityLevel, error); + captureCommitPhaseError(childToDelete, firstChild, error); } } - firstChild = renderPriorityLevel.child; - if (0 !== (renderPriorityLevel.subtreeFlags & 6454) && null !== firstChild) - (firstChild.return = renderPriorityLevel), (nextEffect = firstChild); + deletions = firstChild.child; + if (0 !== (firstChild.subtreeFlags & 6454) && null !== deletions) + (deletions.return = firstChild), (nextEffect = deletions); else for (; null !== nextEffect; ) { - renderPriorityLevel = nextEffect; + firstChild = nextEffect; try { - var flags = renderPriorityLevel.flags; + var flags = firstChild.flags; if (flags & 256) { - var current = renderPriorityLevel.alternate; + var current = firstChild.alternate; if (null !== current) { var currentRef = current.ref; null !== currentRef && @@ -6178,38 +6136,34 @@ function commitMutationEffects(root, renderPriorityLevel, firstChild) { } switch (flags & 2054) { case 2: - commitPlacement(renderPriorityLevel); - renderPriorityLevel.flags &= -3; + commitPlacement(firstChild); + firstChild.flags &= -3; break; case 6: - commitPlacement(renderPriorityLevel); - renderPriorityLevel.flags &= -3; - commitWork(renderPriorityLevel.alternate, renderPriorityLevel); + commitPlacement(firstChild); + firstChild.flags &= -3; + commitWork(firstChild.alternate, firstChild); break; case 2048: - renderPriorityLevel.flags &= -2049; + firstChild.flags &= -2049; break; case 2052: - renderPriorityLevel.flags &= -2049; - commitWork(renderPriorityLevel.alternate, renderPriorityLevel); + firstChild.flags &= -2049; + commitWork(firstChild.alternate, firstChild); break; case 4: - commitWork(renderPriorityLevel.alternate, renderPriorityLevel); + commitWork(firstChild.alternate, firstChild); } } catch (error) { - captureCommitPhaseError( - renderPriorityLevel, - renderPriorityLevel.return, - error - ); + captureCommitPhaseError(firstChild, firstChild.return, error); } - firstChild = renderPriorityLevel.sibling; - if (null !== firstChild) { - firstChild.return = renderPriorityLevel.return; - nextEffect = firstChild; + deletions = firstChild.sibling; + if (null !== deletions) { + deletions.return = firstChild.return; + nextEffect = deletions; break; } - nextEffect = renderPriorityLevel.return; + nextEffect = firstChild.return; } } } @@ -6368,7 +6322,6 @@ var ceil = Math.ceil, legacyErrorBoundariesThatAlreadyFailed = null, rootDoesHavePassiveEffects = !1, rootWithPendingPassiveEffects = null, - pendingPassiveEffectsRenderPriority = 0, pendingPassiveEffectsLanes = 0, nestedUpdateCount = 0, rootWithNestedUpdates = null, @@ -6383,20 +6336,18 @@ function requestEventTime() { : (currentEventTime = now()); } function requestUpdateLane(fiber) { - fiber = fiber.mode; - if (0 === (fiber & 1)) return 1; - if (0 === (fiber & 1)) return 15 === currentUpdateLanePriority ? 1 : 2; + if (0 === (fiber.mode & 1)) return 1; if (0 !== ReactCurrentBatchConfig.transition) return ( 0 === currentEventTransitionLane && ((fiber = nextTransitionLane), (nextTransitionLane <<= 1), - 0 === (nextTransitionLane & 8388096) && (nextTransitionLane = 512), + 0 === (nextTransitionLane & 4194240) && (nextTransitionLane = 64), (currentEventTransitionLane = fiber)), currentEventTransitionLane ); - fiber = currentUpdateLanePriority; - return 0 !== fiber ? findUpdateLane(fiber) : findUpdateLane(8); + fiber = currentUpdatePriority; + return 0 !== fiber ? fiber : 16; } function scheduleUpdateOnFiber(fiber, lane, eventTime) { if (50 < nestedUpdateCount) @@ -6444,7 +6395,8 @@ function ensureRootIsScheduled(root, currentTime) { suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes, expirationTimes = root.expirationTimes, - lanes = root.pendingLanes; + lanes = root.pendingLanes, + expiredLanes = 0; 0 < lanes; ) { @@ -6452,54 +6404,57 @@ function ensureRootIsScheduled(root, currentTime) { lane = 1 << index$6, expirationTime = expirationTimes[index$6]; if (-1 === expirationTime) { - if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) { - expirationTime = currentTime; - getHighestPriorityLanes(lane); - var priority = return_highestLanePriority; - expirationTimes[index$6] = - 10 <= priority - ? expirationTime + 250 - : 6 <= priority - ? expirationTime + 5e3 - : -1; - } - } else expirationTime <= currentTime && (root.expiredLanes |= lane); + if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) + expirationTimes[index$6] = computeExpirationTime(lane, currentTime); + } else expirationTime <= currentTime && (expiredLanes |= lane); lanes &= ~lane; } + 0 !== expiredLanes && markRootExpired(root, expiredLanes); suspendedLanes = getNextLanes( root, root === workInProgressRoot ? workInProgressRootRenderLanes : 0 ); - currentTime = return_highestLanePriority; - 0 === suspendedLanes - ? (null !== existingCallbackNode && - Scheduler_cancelCallback(existingCallbackNode), + if (0 === suspendedLanes) + null !== existingCallbackNode && cancelCallback(existingCallbackNode), (root.callbackNode = null), - (root.callbackPriority = 0)) - : root.callbackPriority !== currentTime && - (null != existingCallbackNode && - Scheduler_cancelCallback(existingCallbackNode), - 15 === currentTime - ? ((existingCallbackNode = performSyncWorkOnRoot.bind(null, root)), - null === syncQueue - ? (syncQueue = [existingCallbackNode]) - : syncQueue.push(existingCallbackNode), - scheduleCallback(99, flushSyncCallbackQueue), - (existingCallbackNode = null)) - : 14 === currentTime - ? (existingCallbackNode = scheduleCallback( - 99, - performSyncWorkOnRoot.bind(null, root) - )) - : ((existingCallbackNode = lanePriorityToSchedulerPriority( - currentTime - )), - (existingCallbackNode = scheduleCallback( - existingCallbackNode, - performConcurrentWorkOnRoot.bind(null, root) - ))), - (root.callbackPriority = currentTime), - (root.callbackNode = existingCallbackNode)); + (root.callbackPriority = 0); + else if ( + ((currentTime = suspendedLanes & -suspendedLanes), + root.callbackPriority !== currentTime) + ) { + null != existingCallbackNode && cancelCallback(existingCallbackNode); + if (1 === currentTime) + (existingCallbackNode = performSyncWorkOnRoot.bind(null, root)), + null === syncQueue + ? (syncQueue = [existingCallbackNode]) + : syncQueue.push(existingCallbackNode), + scheduleCallback(ImmediatePriority, flushSyncCallbackQueue), + (existingCallbackNode = null); + else { + switch (lanesToEventPriority(suspendedLanes)) { + case 1: + existingCallbackNode = ImmediatePriority; + break; + case 4: + existingCallbackNode = UserBlockingPriority; + break; + case 16: + existingCallbackNode = NormalPriority; + break; + case 536870912: + existingCallbackNode = IdlePriority; + break; + default: + existingCallbackNode = NormalPriority; + } + existingCallbackNode = scheduleCallback( + existingCallbackNode, + performConcurrentWorkOnRoot.bind(null, root) + ); + } + root.callbackPriority = currentTime; + root.callbackNode = existingCallbackNode; + } } function performConcurrentWorkOnRoot(root, didTimeout) { currentEventTime = -1; @@ -6516,9 +6471,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { if (0 === lanes) return null; if (didTimeout) return ( - (root.expiredLanes |= lanes & root.pendingLanes), - ensureRootIsScheduled(root, now()), - null + markRootExpired(root, lanes), ensureRootIsScheduled(root, now()), null ); var lanes$jscomp$0 = lanes; didTimeout = executionContext; @@ -6573,7 +6526,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { case 3: markRootSuspended$1(root, lanes); if ( - (lanes & 125829120) === lanes && + (lanes & 130023424) === lanes && ((didTimeout = globalMostRecentFallbackTime + 500 - now()), 10 < didTimeout) ) { @@ -6594,7 +6547,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { break; case 4: markRootSuspended$1(root, lanes); - if ((lanes & 8388096) === lanes) break; + if ((lanes & 4194240) === lanes) break; didTimeout = root.eventTimes; for (prevDispatcher = -1; 0 < lanes; ) { var index$5 = 31 - clz32(lanes); @@ -6656,11 +6609,10 @@ function performSyncWorkOnRoot(root) { if (0 !== (executionContext & 24)) throw Error("Should not already be working."); flushPassiveEffects(); - var lanes = - root === workInProgressRoot && - 0 !== (root.expiredLanes & workInProgressRootRenderLanes) - ? workInProgressRootRenderLanes - : getNextLanes(root, 0); + var lanes; + if ((lanes = root === workInProgressRoot)) + lanes = 0 !== (root.entanglements[0] & workInProgressRootRenderLanes); + lanes = lanes ? workInProgressRootRenderLanes : getNextLanes(root, 0); var exitStatus = renderRootSync(root, lanes); 0 !== root.tag && 2 === exitStatus && @@ -6983,7 +6935,7 @@ function workLoopSync() { for (; null !== workInProgress; ) performUnitOfWork(workInProgress); } function workLoopConcurrent() { - for (; null !== workInProgress && !Scheduler_shouldYield(); ) + for (; null !== workInProgress && !shouldYield(); ) performUnitOfWork(workInProgress); } function performUnitOfWork(unitOfWork) { @@ -7048,12 +7000,12 @@ function completeUnitOfWork(unitOfWork) { 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } function commitRoot(root) { - var previousUpdateLanePriority = currentUpdateLanePriority; + var previousUpdateLanePriority = currentUpdatePriority; try { - (currentUpdateLanePriority = 15), + (currentUpdatePriority = 1), commitRootImpl(root, previousUpdateLanePriority); } finally { - currentUpdateLanePriority = previousUpdateLanePriority; + currentUpdatePriority = previousUpdateLanePriority; } return null; } @@ -7082,34 +7034,32 @@ function commitRootImpl(root, renderPriorityLevel) { 0 === (finishedWork.flags & 1040)) || rootDoesHavePassiveEffects || ((rootDoesHavePassiveEffects = !0), - scheduleCallback(97, function() { + scheduleCallback(NormalPriority, function() { flushPassiveEffects(); return null; })); remainingLanes = 0 !== (finishedWork.flags & 8054); if (0 !== (finishedWork.subtreeFlags & 8054) || remainingLanes) { - remainingLanes = currentUpdateLanePriority; - currentUpdateLanePriority = 15; + remainingLanes = currentUpdatePriority; + currentUpdatePriority = 1; var prevExecutionContext = executionContext; executionContext |= 16; var prevInteractions = pushInteractions(root); ReactCurrentOwner$2.current = null; commitBeforeMutationEffects(root, finishedWork); commitTime = now$1(); - commitMutationEffects(root, renderPriorityLevel, finishedWork); + commitMutationEffects(root, finishedWork); root.current = finishedWork; commitLayoutEffects(finishedWork, root, lanes); requestPaint(); tracing.__interactionsRef.current = prevInteractions; executionContext = prevExecutionContext; - null != remainingLanes && (currentUpdateLanePriority = remainingLanes); + currentUpdatePriority = remainingLanes; } else (root.current = finishedWork), (commitTime = now$1()); if ((prevExecutionContext = rootDoesHavePassiveEffects)) (rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), - (pendingPassiveEffectsLanes = lanes), - (pendingPassiveEffectsRenderPriority = - 0 === renderPriorityLevel ? 8 : renderPriorityLevel); + (pendingPassiveEffectsLanes = lanes); remainingLanes = root.pendingLanes; if (0 !== remainingLanes) { if (null !== spawnedWorkDuringRender) { @@ -7142,19 +7092,15 @@ function commitRootImpl(root, renderPriorityLevel) { return null; } function flushPassiveEffects() { - if (0 !== pendingPassiveEffectsRenderPriority) { - var priorityLevel = - 8 < pendingPassiveEffectsRenderPriority - ? 8 - : pendingPassiveEffectsRenderPriority; - pendingPassiveEffectsRenderPriority = 0; - var previousLanePriority = currentUpdateLanePriority; + if (0 !== pendingPassiveEffectsLanes) { + var b = lanesToEventPriority(pendingPassiveEffectsLanes), + previousPriority = currentUpdatePriority; try { - currentUpdateLanePriority = priorityLevel; + currentUpdatePriority = 16 < b ? 16 : b; if (null === rootWithPendingPassiveEffects) var JSCompiler_inline_result = !1; else { - priorityLevel = rootWithPendingPassiveEffects; + b = rootWithPendingPassiveEffects; var lanes = pendingPassiveEffectsLanes; rootWithPendingPassiveEffects = null; pendingPassiveEffectsLanes = 0; @@ -7162,8 +7108,8 @@ function flushPassiveEffects() { throw Error("Cannot flush passive effects while already rendering."); var prevExecutionContext = executionContext; executionContext |= 16; - var prevInteractions = pushInteractions(priorityLevel); - for (nextEffect = priorityLevel.current; null !== nextEffect; ) { + var prevInteractions = pushInteractions(b); + for (nextEffect = b.current; null !== nextEffect; ) { var fiber = nextEffect, child = fiber.child; if (0 !== (nextEffect.flags & 16)) { @@ -7186,22 +7132,33 @@ function flushPassiveEffects() { else for (; null !== nextEffect; ) { fiber$jscomp$0 = nextEffect; + var sibling = fiber$jscomp$0.sibling, + returnFiber = fiber$jscomp$0.return; if (fiber$jscomp$0 === fiberToDelete) { + detachFiberAfterEffects(fiber$jscomp$0); nextEffect = null; break; } - var sibling = fiber$jscomp$0.sibling; if (null !== sibling) { - sibling.return = fiber$jscomp$0.return; + sibling.return = returnFiber; nextEffect = sibling; break; } - nextEffect = fiber$jscomp$0.return; + nextEffect = returnFiber; } } - var alternate = fiberToDelete.alternate; - detachFiberAfterEffects(fiberToDelete); - null !== alternate && detachFiberAfterEffects(alternate); + } + var previousFiber = fiber.alternate; + if (null !== previousFiber) { + var detachedChild = previousFiber.child; + if (null !== detachedChild) { + previousFiber.child = null; + do { + var detachedSibling = detachedChild.sibling; + detachedChild.sibling = null; + detachedChild = detachedSibling; + } while (null !== detachedChild); + } } nextEffect = fiber; } @@ -7227,7 +7184,7 @@ function flushPassiveEffects() { nextEffect = fiber.return; } } - var finishedWork = priorityLevel.current; + var finishedWork = b.current; for (nextEffect = finishedWork; null !== nextEffect; ) { child = nextEffect; var firstChild = child.child; @@ -7261,14 +7218,14 @@ function flushPassiveEffects() { } } tracing.__interactionsRef.current = prevInteractions; - finishPendingInteractions(priorityLevel, lanes); + finishPendingInteractions(b, lanes); executionContext = prevExecutionContext; flushSyncCallbackQueue(); JSCompiler_inline_result = !0; } return JSCompiler_inline_result; } finally { - currentUpdateLanePriority = previousLanePriority; + currentUpdatePriority = previousPriority; } } return !1; @@ -7340,7 +7297,7 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) { (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && (4 === workInProgressRootExitStatus || (3 === workInProgressRootExitStatus && - (workInProgressRootRenderLanes & 125829120) === + (workInProgressRootRenderLanes & 130023424) === workInProgressRootRenderLanes && 500 > now() - globalMostRecentFallbackTime) ? prepareFreshStack(root, 0) @@ -7353,14 +7310,11 @@ function resolveRetryWakeable(boundaryFiber, wakeable) { null !== retryCache && retryCache.delete(wakeable); wakeable = 0; 0 === wakeable && - ((wakeable = boundaryFiber.mode), - 0 === (wakeable & 1) + (0 === (boundaryFiber.mode & 1) ? (wakeable = 1) - : 0 === (wakeable & 1) - ? (wakeable = 15 === currentUpdateLanePriority ? 1 : 2) : ((wakeable = nextRetryLane), (nextRetryLane <<= 1), - 0 === (nextRetryLane & 125829120) && (nextRetryLane = 8388608))); + 0 === (nextRetryLane & 130023424) && (nextRetryLane = 4194304))); retryCache = requestEventTime(); boundaryFiber = markUpdateLaneFromFiberToRoot(boundaryFiber, wakeable); null !== boundaryFiber && @@ -7944,7 +7898,7 @@ function startWorkOnPendingInteractions(root, lanes) { try { subscriber.onWorkStarted(interactions, root); } catch (error) { - scheduleCallback(99, function() { + scheduleCallback(ImmediatePriority, function() { throw error; }); } @@ -7961,7 +7915,7 @@ function finishPendingInteractions(root, committedLanes) { 1e3 * committedLanes + root.interactionThreadID ); } catch (error) { - scheduleCallback(99, function() { + scheduleCallback(ImmediatePriority, function() { throw error; }); } finally { @@ -7975,7 +7929,7 @@ function finishPendingInteractions(root, committedLanes) { try { subscriber.onInteractionScheduledWorkCompleted(interaction); } catch (error$96) { - scheduleCallback(99, function() { + scheduleCallback(ImmediatePriority, function() { throw error$96; }); } @@ -8189,7 +8143,7 @@ function FiberRootNode(containerInfo, tag, hydrate) { this.callbackPriority = 0; this.eventTimes = createLaneMap(0); this.expirationTimes = createLaneMap(-1); - this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0; + this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0; this.entanglements = createLaneMap(0); this.interactionThreadID = tracing.unstable_getThreadID(); this.memoizedInteractions = new Set(); @@ -8315,10 +8269,10 @@ batchedUpdatesImpl = function(fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1013 = { + devToolsConfig$jscomp$inline_1012 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "17.0.2", + version: "17.0.3", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function() { @@ -8333,11 +8287,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1287 = { - bundleType: devToolsConfig$jscomp$inline_1013.bundleType, - version: devToolsConfig$jscomp$inline_1013.version, - rendererPackageName: devToolsConfig$jscomp$inline_1013.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1013.rendererConfig, +var internals$jscomp$inline_1275 = { + bundleType: devToolsConfig$jscomp$inline_1012.bundleType, + version: devToolsConfig$jscomp$inline_1012.version, + rendererPackageName: devToolsConfig$jscomp$inline_1012.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1012.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -8352,7 +8306,7 @@ var internals$jscomp$inline_1287 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1013.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1012.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, @@ -8361,16 +8315,16 @@ var internals$jscomp$inline_1287 = { getCurrentFiber: null }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1288 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1276 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1288.isDisabled && - hook$jscomp$inline_1288.supportsFiber + !hook$jscomp$inline_1276.isDisabled && + hook$jscomp$inline_1276.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1288.inject( - internals$jscomp$inline_1287 + (rendererID = hook$jscomp$inline_1276.inject( + internals$jscomp$inline_1275 )), - (injectedHook = hook$jscomp$inline_1288); + (injectedHook = hook$jscomp$inline_1276); } catch (err) {} } exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { diff --git a/package.json b/package.json index 9943bb4f0ddef2..98106cbd4ebe04 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "repo-config" ], "peerDependencies": { - "react": "17.0.1" + "react": "17.0.2" }, "dependencies": { "@jest/create-cache-key-function": "^26.5.0", @@ -122,7 +122,7 @@ }, "devDependencies": { "flow-bin": "^0.148.0", - "react": "17.0.1" + "react": "17.0.2" }, "detox": { "test-runner": "jest", diff --git a/packages/rn-tester/package.json b/packages/rn-tester/package.json index 167fcd6bc70000..542445b101b0f0 100644 --- a/packages/rn-tester/package.json +++ b/packages/rn-tester/package.json @@ -14,7 +14,7 @@ "nullthrows": "^1.1.1" }, "peerDependencies": { - "react": "17.0.1", + "react": "17.0.2", "react-native": "*" }, "devDependencies": { diff --git a/repo-config/package.json b/repo-config/package.json index ae3ba53e1414bd..ed024217ae3b4d 100644 --- a/repo-config/package.json +++ b/repo-config/package.json @@ -39,9 +39,9 @@ "jscodeshift": "^0.11.0", "mkdirp": "^0.5.1", "prettier": "1.19.1", - "react": "17.0.1", + "react": "17.0.2", "react-shallow-renderer": "16.14.1", - "react-test-renderer": "17.0.1", + "react-test-renderer": "17.0.2", "shelljs": "^0.7.8", "signedsource": "^1.0.0", "ws": "^6.1.4", diff --git a/template/package.json b/template/package.json index be9c9bc12bcb37..f72d8d7163b5a0 100644 --- a/template/package.json +++ b/template/package.json @@ -10,7 +10,7 @@ "lint": "eslint ." }, "dependencies": { - "react": "17.0.1", + "react": "17.0.2", "react-native": "1000.0.0" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 6e2f4f7794eec5..79857c7e8e55ef 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5737,6 +5737,11 @@ react-is@^16.12.0, react-is@^16.8.1, react-is@^16.8.4: resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.1.tgz#5b3531bd76a645a4c9fb6e693ed36419e3301339" integrity sha512-NAnt2iGDXohE5LI7uBnLnqvLQMtzhkiAOLXTmv+qnF9Ky7xAPcX8Up/xWIhxvLVGJvuLiNc4xQLtuqDRzb4fSA== +react-is@^17.0.2: + version "17.0.2" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" + integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== + react-refresh@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.4.0.tgz#d421f9bd65e0e4b9822a399f14ac56bda9c92292" @@ -5750,20 +5755,20 @@ react-shallow-renderer@16.14.1, react-shallow-renderer@^16.13.1: object-assign "^4.1.1" react-is "^16.12.0 || ^17.0.0" -react-test-renderer@17.0.1: - version "17.0.1" - resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-17.0.1.tgz#3187e636c3063e6ae498aedf21ecf972721574c7" - integrity sha512-/dRae3mj6aObwkjCcxZPlxDFh73XZLgvwhhyON2haZGUEhiaY5EjfAdw+d/rQmlcFwdTpMXCSGVk374QbCTlrA== +react-test-renderer@17.0.2: + version "17.0.2" + resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-17.0.2.tgz#4cd4ae5ef1ad5670fc0ef776e8cc7e1231d9866c" + integrity sha512-yaQ9cB89c17PUb0x6UfWRs7kQCorVdHlutU1boVPEsB8IDZH6n9tHxMacc3y0JoXOJUsZb/t/Mb8FUWMKaM7iQ== dependencies: object-assign "^4.1.1" - react-is "^17.0.1" + react-is "^17.0.2" react-shallow-renderer "^16.13.1" - scheduler "^0.20.1" + scheduler "^0.20.2" -react@17.0.1: - version "17.0.1" - resolved "https://registry.yarnpkg.com/react/-/react-17.0.1.tgz#6e0600416bd57574e3f86d92edba3d9008726127" - integrity sha512-lG9c9UuMHdcAexXtigOZLX8exLWkW0Ku29qPRU8uhF2R9BN96dLCt0psvzPLlHc5OWkgymP3qwTRgbnw5BKx3w== +react@17.0.2: + version "17.0.2" + resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037" + integrity sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA== dependencies: loose-envify "^1.1.0" object-assign "^4.1.1" @@ -6120,6 +6125,14 @@ scheduler@^0.20.1: loose-envify "^1.1.0" object-assign "^4.1.1" +scheduler@^0.20.2: + version "0.20.2" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.20.2.tgz#4baee39436e34aa93b4874bddcbf0fe8b8b50e91" + integrity sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ== + dependencies: + loose-envify "^1.1.0" + object-assign "^4.1.1" + "semver@2 || 3 || 4 || 5", semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"