Skip to content

Commit abbd95a

Browse files
committed
fix: adding popstate and scroll event for SPA navigation
1 parent 9849dcf commit abbd95a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/better-shrimps-sin.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@qwik.dev/router': patch
3+
---
4+
5+
fix: adding popstate and scroll event for SPA navigation

packages/qwik-router/src/runtime/src/spa-init.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ export default event$((_: Event, el: Element) => {
198198
win[scrollEnabled] = true;
199199

200200
setTimeout(() => {
201-
addEventListener('popstate', win[initPopstate]!);
202-
addEventListener('scroll', win[initScroll]!, { passive: true });
201+
win.addEventListener('popstate', win[initPopstate]!);
202+
win.addEventListener('scroll', win[initScroll]!, { passive: true });
203203
document.body.addEventListener('click', win[initAnchors]!);
204204

205205
if (!(win as any).navigation) {

0 commit comments

Comments
 (0)