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
When using throw redirect() within a beforeLoad function, subsequent router.subscribe("onBeforeNavigate") events may fail to trigger, causing potential data loss for components that rely on this event for cleanup or persistence operations.
Which project does this relate to?
Router
Describe the bug
When using
throw redirect()
within abeforeLoad
function, subsequentrouter.subscribe("onBeforeNavigate")
events may fail to trigger, causing potential data loss for components that rely on this event for cleanup or persistence operations.Your Example Website or App
https://github.com/dschu-lab/tanstack-router-onbeforeload-redirect-issue
Steps to Reproduce the Bug or Issue
Subscription to the event is implemented at:
https://github.com/dschu-lab/tanstack-router-onbeforeload-redirect-issue/blob/2eb4bd98e7be565983eb7bac8c889859e51da8f3/src/components/PersistForm/PersistForm.tsx#L44-L51
Expected behavior
The
onBeforeNavigate
event should consistently trigger regardless of whether aredirect(
) was previously thrown in abeforeLoad
orloader
function.Screenshots or Videos
Bildschirmaufnahme.2025-04-02.um.16.46.05.mp4
Platform
Additional context
No response
The text was updated successfully, but these errors were encountered: