Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make viewTransition.finished wait for animations triggered by viewTransition.ready #10787

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/stupid-countries-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Fixes a timing issue in the view transition simulation.
4 changes: 3 additions & 1 deletion packages/astro/src/transitions/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,10 @@ async function updateDOM(
const style = window.getComputedStyle(effect.target, effect.pseudoElement);
return style.animationIterationCount === 'infinite';
}
// Trigger the animations
const currentAnimations = document.getAnimations();
// allow animations triggered by viewTransition.ready to start
await new Promise<void>((r)=>setTimeout(r));
// Trigger view transition animations waiting for data-astro-transition-fallback
document.documentElement.setAttribute(OLD_NEW_ATTR, phase);
const nextAnimations = document.getAnimations();
const newAnimations = nextAnimations.filter(
Expand Down
Loading