Skip to content

Commit

Permalink
fix(gatsby): Prefer a user's shouldUpdateScroll over a plugin's (#16328)
Browse files Browse the repository at this point in the history
Co-Authored-By: Ward Peeters <ward@coding-tech.com>
  • Loading branch information
stefanprobst and wardpeet committed Aug 4, 2019
1 parent 4501eeb commit f02f366
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/gatsby/cache-dir/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ function shouldUpdateScroll(prevRouterProps, { location }) {
getSavedScrollPosition: args => this._stateStorage.read(args),
})
if (results.length > 0) {
return results[0]
// Use the latest registered shouldUpdateScroll result, this allows users to override plugin's configuration
// @see https://github.com/gatsbyjs/gatsby/issues/12038
return results[results.length - 1]
}

if (prevRouterProps) {
Expand Down

0 comments on commit f02f366

Please sign in to comment.