EricHech · GitHub

@EricHech

The leavingUrl/currentUrl comparison in handleHistoryChange used
`leavingLocationInfo.pathname + leavingLocationInfo.search` on the
left side but `location.pathname` (no search) on the right. For any
route with a non-empty search string, the comparison was always
unequal, so the transition block ran on every history event —
including no-op popstates over same-URL entries (e.g. pushed via
window.history.pushState). That triggered a false POP transition
to the previous route while the browser URL stayed put.
Compares pathname+search on both sides so the block runs only when
the URL actually changed. Verified with a new Cypress regression
that pushes a same-URL state on a search-bearing route, calls
history.back(), and asserts the page does not teleport.

Read the original on github.com ↗