File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -652,6 +652,7 @@ export function createRouter(options: RouterOptions): Router {
652
652
pendingLocation = toLocation
653
653
const from = currentRoute . value
654
654
655
+ // TODO: should be moved to web history?
655
656
if ( isBrowser ) {
656
657
saveScrollPosition (
657
658
getScrollKey ( from . fullPath , info . delta ) ,
Original file line number Diff line number Diff line change @@ -123,7 +123,10 @@ export function saveScrollPosition(
123
123
}
124
124
125
125
export function getSavedScrollPosition ( key : string ) {
126
- return scrollPositions . get ( key )
126
+ const scroll = scrollPositions . get ( key )
127
+ // consume it so it's not used again
128
+ scrollPositions . delete ( key )
129
+ return scroll
127
130
}
128
131
129
132
// TODO: RFC about how to save scroll position
You can’t perform that action at this time.
0 commit comments