blockerFn
in router.history.block()
returns true
to block navigation β somewhat confusing
#3876
Labels
documentation
Everything documentation related
Which project does this relate to?
Router
Describe the bug
Hi TanStack team π
While using
router.history.block()
in TanStack Router v1 (via@tanstack/start
), I ran into some confusing behavior:blockerFn
to behave like typical navigation guards (e.g.,return false
to block navigation).return true
β blocks navigationreturn false
β allows navigationThis is quite unexpected β especially coming from the legacy React Router v6
unstable_blocker
API, other router libraries, or even browser APIs likewindow.onbeforeunload
, where returningfalse
or a blocking signal typically prevents navigation.Repro:
The name
ShouldAllowNavigation
strongly implies:true
β should allow navigationfalse
β should block itBut the actual behavior is inverted:
true
β blocks navigationfalse
β allows navigationThanks so much β love the work youβre doing on TanStack π
This router is really powerful and shaping up to be the future of routing in React.
** Versions**
Your Example Website or App
N/A
Steps to Reproduce the Bug or Issue
N/A
Expected behavior
Suggestions:
ShouldBlockNavigation
if the current behavior is intentionalScreenshots or Videos
No response
Platform
** Versions**
Additional context
No response
The text was updated successfully, but these errors were encountered: