You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a button and set its onClick to () => navigate(-1).
Build the project in production mode.
Open app with the Safari iOS 16.
Click on button
Expected Behavior
URL should change and the page's content should change.
Actual Behavior
URL will change but the content will not update, and by a reload the state will fix.
The source of the bug is that safari 16 will not support the popstate event properly, it only triggers on page load when we are using react (SPA), so it's useless.
This problem will cause handlePop not to trigger and the state of BrowserRouter will not update.
The text was updated successfully, but these errors were encountered:
Update:
I noticed that I have some <script async ... /> (like google analytics) in my HTML file and until these scripts are not downloaded popstate will not work.
In my case, I moved injected these scripts in an useEffect, so they will inject into DOM after the whole DOM is rendered and problem fixed
What version of React Router are you using?
6.6.1
Steps to Reproduce
BrowserRouter
as your router.onClick
to() => navigate(-1)
.Expected Behavior
URL should change and the page's content should change.
Actual Behavior
URL will change but the content will not update, and by a reload the state will fix.
The source of the bug is that safari 16 will not support the
popstate
event properly, it only triggers on page load when we are using react (SPA), so it's useless.This problem will cause
handlePop
not to trigger and the state ofBrowserRouter
will not update.The text was updated successfully, but these errors were encountered: