diff --git a/lib/intermediate-representation-dir/production-app.js b/lib/intermediate-representation-dir/production-app.js index fc1e5ef99cc24..a941af53e0507 100644 --- a/lib/intermediate-representation-dir/production-app.js +++ b/lib/intermediate-representation-dir/production-app.js @@ -28,11 +28,21 @@ function onUpdate () { } } +function shouldUpdateScroll (prevRouterProps, { location: { pathname } }) { + if (prevRouterProps) { + const { location: { pathname: oldPathname } } = prevRouterProps + if (oldPathname === pathname) { + return false + } + } + return true +} + ReactDOM.render(( ), typeof window !== `undefined` ? document.getElementById(`react-mount`) : void 0) diff --git a/lib/intermediate-representation-dir/root.js b/lib/intermediate-representation-dir/root.js index af8787a1b9ea2..276ac3ff05a96 100644 --- a/lib/intermediate-representation-dir/root.js +++ b/lib/intermediate-representation-dir/root.js @@ -11,11 +11,21 @@ browserHistory.listen(location => { currentLocation = location }) +function shouldUpdateScroll (prevRouterProps, { location: { pathname } }) { + if (prevRouterProps) { + const { location: { pathname: oldPathname } } = prevRouterProps + if (oldPathname === pathname) { + return false + } + } + return true +} + const Root = () => ( {if (onRouteUpdate) { onRouteUpdate(currentLocation) }}} /> )