Skip to content

Commit 6d8ebea

Browse files
committed
Expand null history state guard to more places
1 parent bc7aa6f commit 6d8ebea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/core/src/history.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ class History {
135135
}
136136

137137
public getScrollRegions(): ScrollRegion[] {
138-
return window.history.state.scrollRegions || []
138+
return window.history.state?.scrollRegions || []
139139
}
140140

141141
public getDocumentScrollPosition(): ScrollRegion {
142-
return window.history.state.documentScrollPosition || { top: 0, left: 0 }
142+
return window.history.state?.documentScrollPosition || { top: 0, left: 0 }
143143
}
144144

145145
public replaceState(page: Page, cb: (() => void) | null = null): void {

0 commit comments

Comments
 (0)