How to Clear Multiple Routes from Navigation History in TanStack Router
- Start at
/account/networks-
navigate({ to: "/account/networks/search" })-
navigate({ to: "/account/networks/search/join-dialog" })- After success action, we want to return to
/account/networksThe Issue:
When using
replace: true to navigate back to /account/networks:- Navigation to
/account/networks works- But then
router.history.back() at /account/networks takes user to /account/networks/search- We want it to go back to
/account - We need to clear both the search and join-dialog routes from history
Is there a way to clear multiple routes ( both the search and join-dialog routes) from the history stack in TanStack Router?Navigation Flow: