Skip to content

Commit 7b74a2d

Browse files
committed
fix: include callback refs and store syncs in inCommitCallback gate
inCommitCallback only checked EFFECT_BODY_DEPTH, so callback refs (REF_CALLBACK_DEPTH) and store consistency checks (STORE_SYNC_DEPTH) could still fall through to IN_FLIGHT_TRANSITION_ACTION_BATCH and ASYNC_TRANSITION_COUNT, joining a pending Action or staying at transition priority. Extend the predicate to cover all commit-phase callback depths.
1 parent f90a5c3 commit 7b74a2d

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎packages/octane/src/runtime.ts‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2686,14 +2686,18 @@ function createTransitionActionBatch(): TransitionActionBatch {
26862686
}
26872687

26882688
/**
2689-
* Insertion and layout effect callbacks run synchronously inside a commit, so no
2690-
* post-await Action continuation can be on the stack. Like React, their updates
2691-
* are urgent and never join an in-flight Action; commitEffects also clears any
2692-
* transition the commit inherited. A transition started inside the callback
2693-
* still owns its own updates.
2689+
* Insertion and layout effect callbacks, callback refs and store consistency
2690+
* checks run synchronously inside a commit, so no post-await Action continuation
2691+
* can be on the stack. Like React, their updates are urgent and never join an
2692+
* in-flight Action; commitEffects also clears any transition the commit
2693+
* inherited. A transition started inside the callback still owns its own updates.
26942694
*/
26952695
function inCommitCallback(): boolean {
2696-
return EFFECT_BODY_DEPTH > 0 && CURRENT_EFFECT_PHASE !== PASSIVE;
2696+
return (
2697+
(EFFECT_BODY_DEPTH > 0 && CURRENT_EFFECT_PHASE !== PASSIVE) ||
2698+
REF_CALLBACK_DEPTH > 0 ||
2699+
STORE_SYNC_DEPTH > 0
2700+
);
26972701
}
26982702

26992703
function transitionActionBatchForUpdate(): TransitionActionBatch | null {

0 commit comments

Comments
 (0)