diff options
author | 2024-03-15 19:04:41 +0100 | |
---|---|---|
committer | 2024-03-15 19:04:41 +0100 | |
commit | 1900a8f9bc337f3a882178d1770e10ab67fab0ce (patch) | |
tree | 24ed487a75b4bb92c45d9640e3b67bbaa6282735 | |
parent | 8a80dbfddeb57d4890388aaa31e1033fac864fe8 (diff) | |
download | astro-1900a8f9bc337f3a882178d1770e10ab67fab0ce.tar.gz astro-1900a8f9bc337f3a882178d1770e10ab67fab0ce.tar.zst astro-1900a8f9bc337f3a882178d1770e10ab67fab0ce.zip |
Fixes an TypeError when using without (#10456)
-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 }); } }; |