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
If createBrowserRouter after single-spa injected, it will be affected.
At the time, useBlocker's disposer haven't executed, and blocker.state === 'unblock', single-spa's popstate will trigger another history restore, which delta is 0, and try to execute history.go(0), finally cause reload.
Possible fix is ignore delta === 0
The text was updated successfully, but these errors were encountered:
What version of React Router are you using?
6.23.1
Steps to Reproduce
sandbox: https://stackblitz.com/edit/github-yc7ha4?file=index.html
Click
go test
>proceed
Expected Behavior
Redirect success without reload page
Actual Behavior
Page will reload due to this code:
https://github.com/remix-run/react-router/blob/main/packages/router/router.ts#L1004
Actually I had trace the reason,
single-spa
will inject history api, which make history.pushState
/replaceState
fire extra syntheticpopstate
event( BY DESIGN, see: https://single-spa.js.org/docs/api/#popstateevent and single-spa/single-spa#528)If
createBrowserRouter
aftersingle-spa
injected, it will be affected.At the time,
useBlocker
's disposer haven't executed, and blocker.state === 'unblock',single-spa
'spopstate
will trigger another history restore, whichdelta
is0
, and try to executehistory.go(0)
, finally cause reload.Possible fix is ignore
delta === 0
The text was updated successfully, but these errors were encountered: