diff --git a/packages/react-reconciler/src/ReactFiberHooks.js b/packages/react-reconciler/src/ReactFiberHooks.js index 1740ee0a8600a..276c6d85e97ee 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.js +++ b/packages/react-reconciler/src/ReactFiberHooks.js @@ -1961,6 +1961,7 @@ function mountOptimistic( // This is different than the normal setState function. const dispatch: A => void = (dispatchOptimisticSetState.bind( null, + 'setOptimistic()', currentlyRenderingFiber, true, queue, @@ -2398,6 +2399,7 @@ function mountActionState( const pendingStateHook = mountStateImpl((false: Thenable | boolean)); const setPendingState: boolean => void = (dispatchOptimisticSetState.bind( null, + 'useActionState()', currentlyRenderingFiber, false, ((pendingStateHook.queue: any): UpdateQueue< @@ -3117,7 +3119,7 @@ function startTransition( // diverges; for example, both an optimistic update and this one should // share the same lane. ReactSharedInternals.T = currentTransition; - dispatchOptimisticSetState(fiber, false, queue, pendingState); + dispatchOptimisticSetState('useTransition()', fiber, false, queue, pendingState); try { const returnValue = callback(); @@ -3682,6 +3684,7 @@ function dispatchSetStateInternal( } function dispatchOptimisticSetState( + label: string, fiber: Fiber, throwIfDuringRender: boolean, queue: UpdateQueue, @@ -3766,7 +3769,7 @@ function dispatchOptimisticSetState( // will never be attempted before the optimistic update. This currently // holds because the optimistic update is always synchronous. If we ever // change that, we'll need to account for this. - startUpdateTimerByLane(lane, 'setOptimistic()'); + startUpdateTimerByLane(lane, label); scheduleUpdateOnFiber(root, fiber, lane); // Optimistic updates are always synchronous, so we don't need to call // entangleTransitionUpdate here.