You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Components are rendered twice when navigating to them. I would expect that a component is only rendered once.
This reproduction code is the file based quickstart example from the website with the following modifications:
Added console.logs in the Root, Index, and About components.
Disable pre-loading (the bug reproduces with it enabled or disabled but it is clearer to see the logging with pre-loading disabled)
In case this helps anyone still seeing this issue, I found that having StrictMode as shown in the docs, it rerenders twice in dev but DOES NOT in prod build.
I also had this issue, but it was user error in my case. I was accidentally rendering <Outlet /> twice in my root component due to a quick and messy migration to tanstack-router. Worth taking small moments to sanity check things to potentially save hours of headache later.
Reacted by Manuel Schiller, Łukasz Myśliński and Alex Iurkov
In case this helps anyone still seeing this issue, I found that having StrictMode as shown in the docs, it rerenders twice in dev but DOES NOT in prod build.
That means it is rendered via a React.useEffect, that gets called twice in StrictMode. Would be easy to fix on TanstackDevTool's side.
I can confirm, once I drag the devtools outside the StrictMode context it works as intended. Good find @toph-pottschmidt!
Activity
SeanCassiere commentedon Jun 25, 2024
We don't memoize your components. We follow React's rendering.
Same thing, with the memoization: https://stackblitz.com/edit/github-mg7svm-ed3yqq?file=src%2Froutes%2F__root.tsx
nimish-gupta commentedon Sep 12, 2024
Getting same double rendering issue in my project
Not able to open this link, i added memoization too, but just want to check it.
schiller-manuel commentedon Sep 12, 2024
@nimish-gupta can you please open a new issue and provide a minimal complete example by forking one of the examples on stackblitz?
abartolo commentedon Jan 15, 2025
In case this helps anyone still seeing this issue, I found that having
StrictModeas shown in the docs, it rerenders twice in dev but DOES NOT in prod build.toph-pottschmidt commentedon Apr 14, 2025
I also had this issue, but it was user error in my case. I was accidentally rendering
<Outlet />twice in my root component due to a quick and messy migration to tanstack-router. Worth taking small moments to sanity check things to potentially save hours of headache later.lmyslinski commentedon Jan 18, 2026
@toph-pottschmidt Thank you - I was loosing my mind over this and thanks you to I found out I had the exact same issue in my code.
krnlde commentedon Mar 20, 2026
That means it is rendered via a React.useEffect, that gets called twice in StrictMode. Would be easy to fix on TanstackDevTool's side.
I can confirm, once I drag the devtools outside the StrictMode context it works as intended. Good find @toph-pottschmidt!