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 abeforeLoadfunction, 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
onBeforeNavigateevent should consistently trigger regardless of whether aredirect() was previously thrown in abeforeLoadorloaderfunction.Screenshots or Videos
Bildschirmaufnahme.2025-04-02.um.16.46.05.mp4
Platform
Additional context
No response