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]: HashRouter: Hitting "back" button in the browser or calling "navigate(-1)" doesn't navigate if navigation is blocked via history.block() #8745

Closed
antonabramovich opened this issue Mar 29, 2022 · 1 comment
Labels

Comments

@antonabramovich
Copy link

antonabramovich commented Mar 29, 2022

What version of React Router are you using?

6.2.2

Steps to Reproduce

  1. Navigate to a route which blocks the navigation via "history.block()". Blocker function allows navigation instantaneously, based on some provided condition, without prompting the user in any way.
  2. Try clicking browser "back" button or call "navigate(-1)"
  3. Try once more

Demo: https://stackblitz.com/edit/react-ts-eyafwn?file=index.tsx
P.S. BrowserRouter works correctly with this scenario.
P.P.S. Seems to be Chromium-specific

Expected Behavior

Blocker is called, and, if "transition.retry()" is triggered, user is navigated to a previous page after the first "back" button click (or navigate(-1) call).

Actual Behavior

URL is not changed. Blocker is called, but calling "transtion.retry()" does nothing for the first time. Navigation only happens on the second interaction.

@timdorr
Copy link
Member

timdorr commented Mar 29, 2022

This is essentially a duplicate of #8139. We need those APIs added back to support this kind of behavior in a React-compatible way.

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

2 participants