demo · v140
Timing Diagram
When does the finished promise resolve? Before 140 it resolved within the rendering lifecycle — so any cleanup code that ran in .then() happened after the final frame was committed, producing a flicker. Post-140 it resolves before the cleanup frame.
pre-140 (flickers)
post-140 (no flicker)
view transition animation
frame commit
cleanup script
document.startViewTransition(() => render()).finished.then(() => {
// pre-140: this ran AFTER the final frame committed
// → one extra layout that often re-painted the page
// post-140: runs BEFORE the cleanup frame
// → no flicker
el.classList.remove("animating");
});
see also
- VT finished promise timing — feature index
- Spec changes