TanStackT
TanStack5mo ago
2 replies
standard-azure

Question about loader / beforeLoading

So what do I do in this type of case :

/$id
  route.tsx    <-- Need to fetch some data about related to the $id
  path-a.tsx
  path-b.tsx.  <-- Need to access the `route.tsx` data in its own `loader()`.


If I put my dataloading in the beforeLoad of the route.tx, I can pass it in the context and all is fine, the children paths have assess to it. But, the beforeLoad seems to refetch every navigation, but I don't want to do that since the information only changes when the $id changes.

I know that the loader() are run all at the same time for the routes so the children cannot access the data of the parent in their loader(), so what should I do ?
Was this page helpful?