Skip to content

Commit e280efd

Browse files
committed
[changed] Don't restore scroll position on Forward
We can't reliably restore scroll position on Forward due to browser differences and incompatibilities. Instead, we will only restore previous scroll position when user presses Back, and scroll to top on Forward. Fixes remix-run#707.
1 parent 8a1b630 commit e280efd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/createRouter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ function createRouter(options) {
344344

345345
// Record the scroll position as early as possible to
346346
// get it before browsers try update it automatically.
347-
if (prevPath && action !== LocationActions.REPLACE)
347+
if (prevPath && action === LocationActions.PUSH)
348348
this.recordScrollPosition(prevPath);
349349

350350
var match = this.match(path);

0 commit comments

Comments
 (0)