T
TanStack8mo ago
adverse-sapphire

context not up to date in `beforeload` (with stackblitz)

I have a typed context set up to capture permissions and I want to use them in beforeLoad similar to how the docs describe where I pass it to the routing provider, but the context isn't being updated until after beforeLoad runs -- what am i missing here? see stackblitz below https://stackblitz.com/edit/tanstack-router-56o6e9vq?file=src%2Froutes%2Findex.tsx
Paul DeVito
StackBlitz
Router Basic File Based Example (forked) - StackBlitz
Run official live example code for Router Basic File Based, created by Tanstack on StackBlitz
Authenticated Routes | TanStack Router React Docs
Authentication is an extremely common requirement for web applications. In this guide, we'll walk through how to use TanStack Router to build protected routes, and how to redirect users to login if th...
1 Reply
adverse-sapphire
adverse-sapphireOP8mo ago
so idk if it's the RIGHT way, but at least one way i found around this is to add a loading guard from the api before the routingprovider

Did you find this page helpful?