diff options
-rw-r--r-- | .changeset/thirty-dancers-wink.md | 5 | ||||
-rw-r--r-- | packages/astro/src/transitions/router.ts | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/.changeset/thirty-dancers-wink.md b/.changeset/thirty-dancers-wink.md new file mode 100644 index 000000000..dfe386f44 --- /dev/null +++ b/.changeset/thirty-dancers-wink.md @@ -0,0 +1,5 @@ +--- +"astro": patch +--- + +Fixes an error when using `astro:transtions/client` without `<ViewTransitions/>` diff --git a/packages/astro/src/transitions/router.ts b/packages/astro/src/transitions/router.ts index 69f4e717c..db5a5ea73 100644 --- a/packages/astro/src/transitions/router.ts +++ b/packages/astro/src/transitions/router.ts @@ -622,7 +622,7 @@ const onScrollEnd = () => { // "scrollend" events. To avoid redundant work and expensive calls to // `replaceState()`, we simply check that the values are different before // updating. - if (scrollX !== history.state.scrollX || scrollY !== history.state.scrollY) { + if (history.state && (scrollX !== history.state.scrollX || scrollY !== history.state.scrollY)) { updateScrollPosition({ scrollX, scrollY }); } }; |