T
TanStack3mo ago
foreign-sapphire

beforeLoad or loader called multiple times

Hi! I'm having an issue with start and router. If you have nested routes or pathless layouts it will call beforeLoad from the parent on each child page. Following the authentication example, we get the user inside the beforeLoad method in the __root.tsx file, then each nested route will call that server function before render You can see the problem here: https://tanstack.com/start/latest/docs/framework/react/examples/start-basic-auth when navigating to posts it will call it 3 times before rendering Is that expected?
React TanStack Start Start Basic Auth Example | TanStack Start Docs
An example showing how to implement Start Basic Auth in React using TanStack Start.
3 Replies
national-gold
national-gold3mo ago
GitHub
Performance is horrible when using recommended Authentication patte...
Which project does this relate to? Router Describe the bug When using the recommended patterns for authentication, particularily in tanstack start, the performance of the app is garbage. because on...
national-gold
national-gold3mo ago
You can use tanstack query to cache the results meanwhile, but seems like a solution is on the way
foreign-sapphire
foreign-sapphireOP3mo ago
Oh yes, it's the same thing. Thank you!

Did you find this page helpful?