Skip to content

Commit

Permalink
fix(gatsby): scroll restoration issue in browser API (#27384) (#28477)
Browse files Browse the repository at this point in the history
* fix scroll restoration issue

* keep the behavior same

* fix the lint error

(cherry picked from commit 4a7a324)

Co-authored-by: vrabe <git@vrabe.tw>
  • Loading branch information
GatsbyJS Bot and vrabe authored Dec 4, 2020
1 parent 94f5772 commit 7a6b7ae
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/gatsby/cache-dir/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ function shouldUpdateScroll(prevRouterProps, { location }) {
// `pathname` for backwards compatibility
pathname,
routerProps: { location },
getSavedScrollPosition: args => this._stateStorage.read(args),
getSavedScrollPosition: args => [
0,
this._stateStorage.read(args, args.key),
],
})
if (results.length > 0) {
// Use the latest registered shouldUpdateScroll result, this allows users to override plugin's configuration
Expand Down

0 comments on commit 7a6b7ae

Please sign in to comment.