summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.changeset/witty-bikes-relate.md5
-rw-r--r--packages/astro/components/ViewTransitions.astro2
2 files changed, 6 insertions, 1 deletions
diff --git a/.changeset/witty-bikes-relate.md b/.changeset/witty-bikes-relate.md
new file mode 100644
index 000000000..0222d209b
--- /dev/null
+++ b/.changeset/witty-bikes-relate.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+fix for #7882 by setting state in page navigation (view transitions)
diff --git a/packages/astro/components/ViewTransitions.astro b/packages/astro/components/ViewTransitions.astro
index ac40608d3..d96a85181 100644
--- a/packages/astro/components/ViewTransitions.astro
+++ b/packages/astro/components/ViewTransitions.astro
@@ -187,7 +187,7 @@ const { fallback = 'animate' } = Astro.props as Props;
transitionEnabledOnThisPage()
) {
ev.preventDefault();
- navigate('forward', link.href);
+ navigate('forward', link.href, { index:currentHistoryIndex, scrollY:0 });
currentHistoryIndex++;
const newState: State = { index: currentHistoryIndex, scrollY };
persistState({ index: currentHistoryIndex - 1, scrollY });