T
TanStack2y ago
continuing-cyan

Why is parent route's loader triggered when children change

Example from the docs: https://tanstack.com/router/v1/docs/framework/react/examples/location-masking If you go to /photos and then /photos/$photoId/modal, the parent loader is triggered every time, even though its state doesn't change: Why is that? Is that a bug?
React Router Location Masking Example | TanStack Router Docs
An example showing how to implement Location Masking in React Router
No description
2 Replies
national-gold
national-gold16mo ago
Did you get any feedback on this?
absent-sapphire
absent-sapphire16mo ago
This is because the route is nested under the photos parent. You can opt out of it by not listing $photoId's parent as the photos route, rather the root route.

Did you find this page helpful?