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
{{ message }}
Repository navigation
useMatchRoute not updating when using React Compiler #4499
Correct, only happens with React Compiler enabled. It's very much possible this is a bug in React Compiler. When this is the case, knowing the insides of the package might help clarify the issue to the react team, no? I'd be happy to report the issue to them, but I feel like a lack a bit of context.
I have experienced the same issue and have extracted the code into its own hook with "use no memo" to make it work.
functionuseIsSettings(){"use no memo";constmatchRoute=useMatchRoute();constisSettings=!!matchRoute({to: "/w/$workspaceId/settings",fuzzy: true,});returnisSettings;}
Activity
brenelz commentedon Jul 10, 2025
This only happens with the React Compiler enabled? Maybe this is a bug with that?
vixducis commentedon Jul 11, 2025
Correct, only happens with React Compiler enabled. It's very much possible this is a bug in React Compiler. When this is the case, knowing the insides of the package might help clarify the issue to the react team, no? I'd be happy to report the issue to them, but I feel like a lack a bit of context.
MYKEU commentedon Aug 7, 2025
Our current workaround consists of using
useMatchesor theuse no memodirectiveivan-dalmet commentedon Oct 9, 2025
Update: Issue is still here with the 1.0.0 of react compiler and 1.132.47 of tanstack router.
Workaround
'use no memo'at the top of the file is workingtelcy commentedon Dec 3, 2025
babel-plugin-react-compiler 1.0.0
@tanstack/react-router 1.139.14
I have experienced the same issue and have extracted the code into its own hook with "use no memo" to make it work.
fix(react-router): prevent stale closures in useMatchRoute with React…
fix: keep the settings tab highlight in sync with the open page