How to share param schemas between file routes without breaking react-refresh
#6303
Closed
jedwards1211
started this conversation in
General
Replies: 1 comment 1 reply
-
|
look at https://tanstack.com/router/latest/docs/api/file-based-routing#routefileignoreprefix |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have
/users/$userId,/users/$userId/change-email,/users/$userId/change-passwordetc routes. I want to share the schema for theuserIdparam between all the file routes for these. Here's the code for/users/$userId:routes/users/$userId/index.tsxHere's the problem...I want to
exporttheparamsSchemato share it withroutes/users/$userId/change-email.tsxetc, but if I do so, I get an ESLint warning that it breaksreact-refresh:My unappealing set of options right now seems to be:
routesindex.tsxroute to some other file completely outsideroutes(would create circular imports ugh, though I guess there probably wouldn't be tdz issues)UserRouteand tackparamsSchemaonto it as a property (hacky workaround)At the very least I wish I could export it from a file next to
routes/users/$userId/index.tsxwith some kind of special name that prevents the codegen tool from treating it as a route.Beta Was this translation helpful? Give feedback.
All reactions