Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser forward button navigates to wrong pages #8409

Closed
davemollen opened this issue Jun 10, 2020 · 4 comments
Closed

Browser forward button navigates to wrong pages #8409

davemollen opened this issue Jun 10, 2020 · 4 comments
Labels

Comments

@davemollen
Copy link

Current Behavior

When you hit the browser forward button the browser history gets scrambled. You end up on unexpected pages.

Expected Behavior

Whenever the browser forward button is available I would expect to be able to go forward to the previously visited pages.

How to reproduce

Here’s a repository to reproduce the problem: https://github.com/davemollen/browser-history-bug

  • Run yarn to install
  • Launch expo for web
  • Navigate to different pages by pushing the buttons. Then play around with the browser back and forward buttons to see what page and url you land on.

Your Environment

software version
iOS or Android Web
@react-navigation/native 5.5.1
react-native https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz
expo 37.0.3
node 13.10.1
yarn 1.19.1
@davemollen davemollen added the bug label Jun 10, 2020
@satya164
Copy link
Member

Navigate to different pages by pushing the buttons. Then play around with the browser back and forward buttons to see what page and url you land on.

Please describe what behaviour you expect and current behaviour.

@davemollen
Copy link
Author

davemollen commented Jun 10, 2020

If you first navigate from page 1 to page 2 to page 3 through the buttons, and then follow up by hitting the browser back button to go back to page 2 and then to page 1.
I would expect the browser forward button to take you back to page 2 first and after that to page 3.

But currently the browser forward button takes you to page 2 first and after that it goes to page 1.

@SleeplessByte
Copy link

In short: it stops working after the first back. By stops working I mean either doesn't refresh the app at all (and load the correct screen), or loads the incorrect screen. This behaviour was present before, but got easier to reproduce.

I don't now if #8367 is released yet, but that might have introduced the reproducible behaviour (or fixed it, if it's not yet released).

@SleeplessByte
Copy link

SleeplessByte commented Jun 16, 2020

Here is a snack to reproduce:

https://snack.expo.io/@derk-jan/react-navigation-5:-broken-web-linking

  1. press single ✅ (expected single, works)
  2. press double ✅ (expected double, works)
  3. press back BROWSER BUTTON ✅ (expected single, works)
  4. press forward ❌ (expected double, got landing)

Here is another way to reproduce

  1. press login ✅ (expected remount on landing, works)~
  2. press single ✅ (expected single, works)
  3. press back BROWSER BUTTON ✅ (expected landing, works)
  4. can't press forward ❌ (it doesn't do anything, but it does change the url)

Everything works fine if you only use the header back button.

Problem used to be reproducible to inject (navigate) route on non-last-index, now it happens on every back -> forward combination.

edit: made the snack simpler. Remounting not necessary to reproduce.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants