Skip to content

Commit a1f1e0a

Browse files
committed
fix(octane): remove upgraded block from TRANSITION_QUEUE to prevent leftovers
upgradeTransitionBlock pushed a block onto QUEUE but left it in TRANSITION_QUEUE. The leftover was later adopted by the transition task with a non-transition pendingMode, causing queueAllTransition to return false and potentially skipping ViewTransition wrapping. The stale transitionTask also kept afterTransitionFlush followups (e.g. isPending falling edge) waiting for a no-op task instead of running after the microtask flush that already committed the work. Fix: splice the block out of TRANSITION_QUEUE on upgrade, and retire the transition task (flushing followups) when the queue becomes empty.
1 parent 85cbe3f commit a1f1e0a

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

‎packages/octane/src/runtime.ts‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7665,18 +7665,16 @@ function queueTransitionBlock(block: Block, cue?: boolean): boolean {
76657665

76667666
/** An urgent update or pending cue moves a waiting block onto the microtask flush. */
76677667
function upgradeTransitionBlock(block: Block, mode: 'urgent' | 'transition', cue?: boolean): void {
7668-
if (
7669-
(mode !== 'urgent' && !cue) ||
7670-
block.pendingMode !== 'transition' ||
7671-
syncFlush ||
7672-
!TRANSITION_QUEUE.includes(block)
7673-
)
7674-
return;
7668+
if ((mode !== 'urgent' && !cue) || block.pendingMode !== 'transition' || syncFlush) return;
7669+
const idx = TRANSITION_QUEUE.indexOf(block);
7670+
if (idx === -1) return;
7671+
TRANSITION_QUEUE.splice(idx, 1);
76757672
QUEUE.push(block);
76767673
if (!scheduled) {
76777674
scheduled = true;
76787675
queueMicrotask(flush);
76797676
}
7677+
if (TRANSITION_QUEUE.length === 0) adoptTransitionQueue();
76807678
}
76817679

76827680
function scheduleTransitionTask(): void {

0 commit comments

Comments
 (0)