Blocker does not guard browser back like react-router
Loving the way the router works ❤️
We are currently migrating from react-router and has the mentioned issue since we need to guard the back button (crucial for us). (Works in react router)
I was just wondering what the difference between how
react-router
is since there it works as one might expect there?
Please see https://codesandbox.io/p/sandbox/react-router-6-use-prompt-use-blocker-17r2f?file=%2Findex.js
Link to my github comment: https://github.com/TanStack/router/issues/701#issuecomment-2178590737GitHub
Navigation Blocking doesn't work with browser's back button. · Issu...
Describe the bug Navigation blocking works with Link or useNavigate but doesn't work with browser's back button. So if someone go back using back button, blocking is being surpassed. Your E...
3 Replies
protestant-coral•15mo ago
react-router uses window.confirm: https://developer.mozilla.org/en-US/docs/Web/API/Window/confirm
MDN Web Docs
Window: confirm() method - Web APIs | MDN
window.confirm() instructs the browser to display a dialog with an optional message, and to wait until the user either confirms or cancels the dialog.
protestant-coral•15mo ago
GitHub
react-router/packages/react-router-dom/index.tsx at aacc2b94088835d...
Declarative routing for React. Contribute to remix-run/react-router development by creating an account on GitHub.
protestant-coral•15mo ago
as similar hook should be possible in @tanstack/router