0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

prevents access to the history state if not set (#12436)

This commit is contained in:
Martin Trapp 2024-11-15 09:09:05 +01:00 committed by GitHub
parent e64ec5f9df
commit 453ec6b12f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fixes a potential null access in the clientside router

View file

@ -636,7 +636,7 @@ if (inBrowser) {
'scroll', 'scroll',
() => { () => {
if (intervalId !== undefined) return; 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); intervalId = window.setInterval(scrollInterval, 50);
}, },
{ passive: true }, { passive: true },