Skip to content

Commit 47835ee

Browse files
authored
Floating point fix for scroll restore (#2086)
pull in scroll restore fix suggested by @julamb
1 parent c4ddebc commit 47835ee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/hooks/use-scroll-restoration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { useLocation, useNavigation } from 'react-router-dom'
1010

1111
function getScrollPosition(key: string) {
1212
const pos = window.sessionStorage.getItem(key)
13-
return pos && /^[0-9]+$/.test(pos) ? parseInt(pos, 10) : 0
13+
return Number(pos) || 0
1414
}
1515

1616
function setScrollPosition(key: string, pos: number) {

0 commit comments

Comments
 (0)