From 6a483be4eb949ebfb983d7c1f420b54615740dcd Mon Sep 17 00:00:00 2001 From: Martin Trapp <94928215+martrapp@users.noreply.github.com> Date: Thu, 14 Nov 2024 18:56:57 +0100 Subject: [PATCH 1/2] coping with missing state --- packages/astro/src/transitions/router.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/astro/src/transitions/router.ts b/packages/astro/src/transitions/router.ts index 2be12895e53f..cb5476a7a588 100644 --- a/packages/astro/src/transitions/router.ts +++ b/packages/astro/src/transitions/router.ts @@ -636,7 +636,7 @@ if (inBrowser) { 'scroll', () => { if (intervalId !== undefined) return; - (lastIndex = history.state.index), (lastY = scrollY), (lastX = scrollX); + (lastIndex = history.state?.index), (lastY = scrollY), (lastX = scrollX); intervalId = window.setInterval(scrollInterval, 50); }, { passive: true }, From ed464bb1e1d5bb5422a4d8d39d0b7f07490f6c69 Mon Sep 17 00:00:00 2001 From: Martin Trapp <94928215+martrapp@users.noreply.github.com> Date: Fri, 15 Nov 2024 07:52:41 +0100 Subject: [PATCH 2/2] adds changeset --- .changeset/dirty-teachers-know.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/dirty-teachers-know.md diff --git a/.changeset/dirty-teachers-know.md b/.changeset/dirty-teachers-know.md new file mode 100644 index 000000000000..951117ffff1a --- /dev/null +++ b/.changeset/dirty-teachers-know.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes a potential null access in the clientside router