T
TanStack16mo ago
harsh-harlequin

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
harsh-harlequin
harsh-harlequinOP16mo 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
like-gold
like-gold16mo 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...
harsh-harlequin
harsh-harlequinOP16mo 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
like-gold
like-gold16mo ago
by "blank page" you mean that the "Hello /_auth/dashboard!" is not shown, right?
harsh-harlequin
harsh-harlequinOP16mo ago
Yes, right
like-gold
like-gold16mo ago
can you please create a separate github issue so we can track this

Did you find this page helpful?