T
TanStack2y ago
absent-sapphire

Auth Guarded Route doesn`t load lazy component

When I reset the site data, some lazy routes (auth guarded) in the dashboard don't load when going from login to their pages. After navigating through the dashboard, the pages start loading as they should. And then this problem does not occur. It seems that under some conditions lazy components are not loaded. Making routes with createFileRoute help to solve the problem. But i want to use this feature. Is there another way to create lazy route with file-base stracture? Help please.
6 Replies
absent-sapphire
absent-sapphireOP2y ago
@Tanner Linsley <@&720742901851619479> Maybe this example can help https://stackblitz.com/edit/tanstack-router-gdphgk?file=src%2Froutes%2F_auth.dashboard.tsx Go to dashboard and you will see blank page
Alex
StackBlitz
Router Authenticated Routes Example (forked) - StackBlitz
Run official live example code for Router Authenticated Routes, created by Tanstack on StackBlitz
foreign-sapphire
foreign-sapphire2y ago
please check if this is the same issue https://github.com/TanStack/router/issues/1534
GitHub
6x reduced CPU cause lazy routes failing during loading or navigati...
Describe the bug I am facing an issue on admin panel I am developing now. Sometimes, I cannot find exact steps to reproduce it just returns nothing in Outlet. I checked all my code tree and there i...
absent-sapphire
absent-sapphireOP2y ago
Hm, seems yes. But in examples of this issue i didn`t see a problem on stackblitz. So i am not sure. I used official React Example: Authenticated Routes and changed dashboard route to lazy and the problem appears on first load. In oder to reproduce it, you need to reaload the app every time. Any info about fixing it or using another aproach for lazy loading? Thanks
foreign-sapphire
foreign-sapphire2y ago
by "blank page" you mean that the "Hello /_auth/dashboard!" is not shown, right?
absent-sapphire
absent-sapphireOP2y ago
Yes, right
foreign-sapphire
foreign-sapphire2y ago
can you please create a separate github issue so we can track this

Did you find this page helpful?