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

[Bug]: Using the browser back button console logs a warning #9998

Closed
matijs opened this issue Jan 29, 2023 · 4 comments · Fixed by #10030
Closed

[Bug]: Using the browser back button console logs a warning #9998

matijs opened this issue Jan 29, 2023 · 4 comments · Fixed by #10030
Labels

Comments

@matijs
Copy link

matijs commented Jan 29, 2023

What version of React Router are you using?

6.8.0

Steps to Reproduce

Minimal test case at https://stackblitz.com/edit/react-ts-gphlmg?file=App.tsx

  1. Navigate to ‘foo’ or ‘bar‘ using the link on the page
  2. Use browser back button to navigate back to the ‘index’
  3. Use the browser forward button to navigate to ‘foo’ or ‘bar’ again

NB. Using only the links on the page works as expected without any warnings in the console.

Expected Behavior

There should (probably?) be no warnings in the console in this simple use case. Nothing is actively blocked and no navigation outside of the router happens (unless using the browser's back/forward button is considered navigation outside of the router).

Actual Behavior

The following warning is logged in the console:

You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via window.history.pushState/window.location.hash instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.

@brophdawg11
Copy link
Contributor

Thanks for the report! Pushed a fix for this in the above PR 👍

@brophdawg11 brophdawg11 added the awaiting release This issue have been fixed and will be released soon label Feb 2, 2023
@brophdawg11
Copy link
Contributor

This is fixed in 6.8.1-pre.0 if you want to give that spin to confirm. If all goes well we should have the stable release out tomorrow or early next week.

@brophdawg11 brophdawg11 self-assigned this Feb 2, 2023
@matijs
Copy link
Author

matijs commented Feb 2, 2023

This is fixed in 6.8.1-pre.0 if you want to give that spin to confirm. If all goes well we should have the stable release out tomorrow or early next week.

Confirmed! No more warnings in the console when navigating forward/backward using the browser buttons.

Looking forward to the patch and thanks!

@brophdawg11
Copy link
Contributor

This is now released in 6.8.1

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

Successfully merging a pull request may close this issue.

2 participants