Redirect in beforeLoad is causing infinite routing
I just notice that navigating to route whose parent route has a redirect in it's beforeLoad method, routes infinitely.
i.e i navigate to '/patients', in it's beforeLoad method, i redirect to another route, say '/patients/approved', instead of redirecting as expected it causes a loop between the two routes or any other route i navigate to after this.
Has anyone experience this before? It was working fine before, i don't what i did wrong.
And i have been trying to reproduce this but can't
https://stackblitz.com/edit/tanstack-router-ssubhpym?file=package.json
Chigoziem Nwaiwu
StackBlitz
Router Basic File Based Example (forked) - StackBlitz
Run official live example code for Router Basic File Based, created by Tanstack on StackBlitz

2 Replies
correct-apricot•6mo ago
probably need to conditionally redirect in the before load
absent-sapphireOP•6mo ago
Guys, i just noticed that when i hover on the link, it will navigate appropriately to the intended page but as soon as i click, it will start looping as if the links are saved somewhere and it will start rendering one after the other infinitely
How do i conditionally redirect in this instance? What should i check?
I really hate myself for this. Is all happening because lint safe fix added navigate as a dependency in one of my useEffects. Mehn, this can be very annoying and time wasting.
Thanks @Manuel Schiller , I'm good now