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
Reacted by Charlie Matters, Brad Carson, Konstantinos Stratis, Guillaume Pannatier, cayter, DimaOsinnii, Wesley, Jacob Gillespie, Will Mruzek, James Restall and 78 more
Reacted by Marek, Criston, Onur Guvenc, Thomas Verleye, Konstantinos Stratis, asamaki, Hunter Blackwell, Roman Slonov, Kevin J, Charles Covey-Brandt and 28 more
Reacted by ⛵️ 長谷川 広樹 🐬
Reacted by Marek, Jan Hejzlar, Criston, Tanner Scadden, Onur Guvenc, Pedro Monteagudo, Konstantinos Stratis, Eric Sizer, asamaki, Hunter Blackwell and 35 more
What's the status on this? Specifically asking for ReactRouter because the root loader doesn't run first there and it seems like everyone using ReactRouter (personally as a stepping stone to Remix) is floundering (see #9327) on how to do authentication.
Reacted by Gabriele Consiglio, binaryartifex, André Zagatti, Calogero Guagenti, Seth Livingston (ISN), Scott Ringwelski, Colin Ramsay, Vahid Najafi, Amir Eldor, Tuco T. and 21 more
Is there any update on this? Authentication is probably the biggest use case.
Reacted by Kalkut, Ilya Radchenko, Dan Gayle, Ari Bouius, Amir Eldor, Amadeo Morán, Daniel Cruz, Jan D'Hollander, Kevin Julián Martínez Escobar, Vahid Najafi and 7 more
We've been trying to get unstable_clientMiddleware to run using react-router@7.7.0 with createBrowserRouter (manual routing) in a Vite project. Despite all our efforts, the client middleware never runs. Does unstable_clientMiddleware only work in file-based routing, or are there other steps we need to take to use it with manual routing?
yeah clientMiddleware is a framework-mode thing because that's where the distinction between server and client comes in (loader/clientLoader, middleware/clientMiddleware). For data routers, everything is "client" so there's no distinction. You can just put unstable_middleware: [...] on your route object
@brophdawg11 thanks for the clarification on this. I changed our code to use unstable_middleware but it still wasn’t working. Eventually, I found some other issues and discussions here and realised that we weren’t defining a loader function on our route-objects – once I added this, everything worked as expected 👍
Activity
knownasilya commentedon Mar 12, 2024
What's the status on this? Specifically asking for ReactRouter because the root loader doesn't run first there and it seems like everyone using ReactRouter (personally as a stepping stone to Remix) is floundering (see #9327) on how to do authentication.
nilansaha commentedon Sep 27, 2024
Is there any update on this? Authentication is probably the biggest use case.
chasoft commentedon Oct 4, 2024
My approach for this is:
However, I'm unable to find
unstable_dataStrategyin version 7.infiniteluke commentedon Oct 28, 2024
@chasoft https://reactrouter.com/en/main/routers/create-browser-router#middleware
jrmyio commentedon Oct 29, 2024
We do still need a way to be able to change dataStrategy using RR7 vite plugin though.
chinanderm commentedon Nov 12, 2024
@infiniteluke Using the new routes.ts pattern, there is nothing similar to RRv6
handleto set up middleware.github-actions commentedon Mar 6, 2025
🤖 Hello there,
We just published version
7.3.0which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!Thanks!
6 remaining items
thomasgadsden commentedon Jul 25, 2025
We've been trying to get
unstable_clientMiddlewareto run using react-router@7.7.0 withcreateBrowserRouter(manual routing) in a Vite project. Despite all our efforts, the client middleware never runs. Doesunstable_clientMiddlewareonly work in file-based routing, or are there other steps we need to take to use it with manual routing?brophdawg11 commentedon Jul 25, 2025
yeah
clientMiddlewareis a framework-mode thing because that's where the distinction between server and client comes in (loader/clientLoader,middleware/clientMiddleware). For data routers, everything is "client" so there's no distinction. You can just putunstable_middleware: [...]on your route objectthomasgadsden commentedon Jul 28, 2025
@brophdawg11 thanks for the clarification on this. I changed our code to use
unstable_middlewarebut it still wasn’t working. Eventually, I found some other issues and discussions here and realised that we weren’t defining aloaderfunction on our route-objects – once I added this, everything worked as expected 👍brophdawg11 commentedon Sep 12, 2025
Released as stable in 7.9.0