diff --git a/packages/gatsby-react-router-scroll/src/ScrollBehaviorContext.js b/packages/gatsby-react-router-scroll/src/ScrollBehaviorContext.js index 7b347b4a73b32..3c431db06558a 100644 --- a/packages/gatsby-react-router-scroll/src/ScrollBehaviorContext.js +++ b/packages/gatsby-react-router-scroll/src/ScrollBehaviorContext.js @@ -51,6 +51,9 @@ class ScrollContext extends React.Component { location: prevProps.location, } + // The "scroll-behavior" package expects the "action" to be on the location + // object so let's copy it over. + location.action = history.action this.scrollBehavior.updateScroll(prevRouterProps, { history, location }) }