Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}) {
const { pathname, hash } = routerProps.location;
if (prevRouterProps) {
const {
location: { pathname: oldPathname },
} = prevRouterProps;
if (shouldPreserveScrollBetween(oldPathname, pathname)) {
return false;
}
} else {
// Always forget scroll for first load.
return [0, 0];
}
// Call it manually so we have a chance to preserve scroll the line before.
// TODO: maybe inline whatever it does.
return oldShouldUpdateScroll.apply(this, arguments);
};