T
TanStack2mo ago
genetic-orange

Rerun root route's beforeLoad when calling router.invalidate()?

I have an app where you may log in. When I log in, I'd like to rerun beforeLoad so that context.user is no longer null. As for React Start, it looks like beforeLoad is exclusively ran on the server, even with ssr: "data-only". This means once the page is loaded, all context from the root route is "stuck" until the page is hard refreshed, not even router.invalidate() can make beforeLoad run.
4 Replies
harsh-harlequin
harsh-harlequin2mo ago
i cannot reproduce this. can you please provide a complete reproducer project?
genetic-orange
genetic-orangeOP2mo ago
Ahh sorry for wasting your time, in my migration from next.js it turns out after creating a queryclient instance that I pass in the context of createRootRoute, I forgot to remove my old query client provider component and only use the single new queryclient
harsh-harlequin
harsh-harlequin2mo ago
so does it work now as expected?
genetic-orange
genetic-orangeOP2mo ago
Yeah, I'll mark as solved

Did you find this page helpful?