`loader` runs on every transition despite `loaderDeps` usage
Hey all 👋
Can someone help clarify how the loader in TanStack Router works?
From what I’ve observed, it seems to run on every successful route transition — even when only a minor search param changes. I tried using loaderDeps, which I assumed would act as the dependency list for when the loader should re-run, but it still re-executes on every change.
I know I can use shouldReload to prevent reloading, but the function doesn’t expose the previous search parameters — which makes it hard to compare and control re-runs precisely.
Has anyone run into this same behavior or found a clean workaround?
Version: "@tanstack/react-router": "1.120.20"
Router def:
2 Replies
rare-sapphire•4w ago
are you able to share more details or a minimal example? Im not seeing any loaders here
like-gold•4w ago
stale time is 0 by default which causes to reload always