T
TanStack8mo ago
genetic-orange

Route Context Undefined in Child Route on Reload

I have a parent route layout at /orgs/$slug that fetches the organization by slug and makes it available to the child route. In the child route /orgs/$slug/dashboard, the organization is inferred as an Organization (non-optional). However, upon reloading the page, I encounter the following error:Can't access property 'id', context.organization is undefined. This error occurs when trying to access the organization data in the child route, even though it should be available according to the TS defintion. Reproduction: https://github.com/thomasfqb12/tanstack-start-undefined-context Am I misunderstanding the usage of route context and beforeLoad? If my context can be undefined, I would expect TypeScript to infer this.
5 Replies
correct-apricot
correct-apricot8mo ago
it should not be undefined
correct-apricot
correct-apricot8mo ago
can you please check if this is the same issue as this? https://github.com/TanStack/router/issues/3278
GitHub
Router context not injected in child routes upon hydration · Issue ...
Which project does this relate to? Router Describe the bug I have a routing structure that involves creating nested layout routes like this: routes/ _auth/ // ...page for authenticated some-auth-pa...
genetic-orange
genetic-orangeOP8mo ago
Same issue ! It was previously working as expected. I will downgrade the dependencies to identify the release that introduced the issue.
correct-apricot
correct-apricot8mo ago
I know where the problem is just did not get around to fix it
afraid-scarlet
afraid-scarlet8mo ago
I think i have the same problem with clerk and __root beforeLoad

Did you find this page helpful?