Skip to content

Commit aeac916

Browse files
committed
label setOptimistic
1 parent a9e24d2 commit aeac916

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/react-reconciler/src/ReactFiberHooks.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,6 +1961,7 @@ function mountOptimistic<S, A>(
19611961
// This is different than the normal setState function.
19621962
const dispatch: A => void = (dispatchOptimisticSetState.bind(
19631963
null,
1964+
'setOptimistic()',
19641965
currentlyRenderingFiber,
19651966
true,
19661967
queue,
@@ -2398,6 +2399,7 @@ function mountActionState<S, P>(
23982399
const pendingStateHook = mountStateImpl((false: Thenable<boolean> | boolean));
23992400
const setPendingState: boolean => void = (dispatchOptimisticSetState.bind(
24002401
null,
2402+
'useActionState()',
24012403
currentlyRenderingFiber,
24022404
false,
24032405
((pendingStateHook.queue: any): UpdateQueue<
@@ -3117,7 +3119,7 @@ function startTransition<S>(
31173119
// diverges; for example, both an optimistic update and this one should
31183120
// share the same lane.
31193121
ReactSharedInternals.T = currentTransition;
3120-
dispatchOptimisticSetState(fiber, false, queue, pendingState);
3122+
dispatchOptimisticSetState('useTransition()', fiber, false, queue, pendingState);
31213123

31223124
try {
31233125
const returnValue = callback();
@@ -3682,6 +3684,7 @@ function dispatchSetStateInternal<S, A>(
36823684
}
36833685

36843686
function dispatchOptimisticSetState<S, A>(
3687+
label: string,
36853688
fiber: Fiber,
36863689
throwIfDuringRender: boolean,
36873690
queue: UpdateQueue<S, A>,
@@ -3766,7 +3769,7 @@ function dispatchOptimisticSetState<S, A>(
37663769
// will never be attempted before the optimistic update. This currently
37673770
// holds because the optimistic update is always synchronous. If we ever
37683771
// change that, we'll need to account for this.
3769-
startUpdateTimerByLane(lane, 'setOptimistic()');
3772+
startUpdateTimerByLane(lane, label);
37703773
scheduleUpdateOnFiber(root, fiber, lane);
37713774
// Optimistic updates are always synchronous, so we don't need to call
37723775
// entangleTransitionUpdate here.

0 commit comments

Comments
 (0)