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
I'm starting this discussion after spending 2 hours debugging 404s in my API routes before I realised I called my API handler api.tsx instead of api.ts.
It would've been nice if the dev server noticed these sorts of mistakes, as the same can happen with ssr.ts instead of ssr.tsx (as that file supports JSX but doesn't use it as of the boilerplate, so there's no indication of the mistake)
I can see this particular problem fixed by either:
Supporting all extensions for these entry files
Warning when they are wrong (my personal preference)
Using .tsx for all of them (API is the only one that doesn't for now)
Regardless, I'd also make this a larger discussion about other ways the folder structure can be set up incorrectly and the dev server can help with warnings (e.g. using API routes without initialising the API handler; exporting a fileRoute from a non-route file - both of these can be detected by watching exports under routes)
I can see these sorts of issues coming up waay less after a Tanstack Start CLI is implemented since it'll be taking care of setting up all the boilerplate. Still, I think on the long run these problems could continue happening and right now they are a nightmare to debug as there's literally nothing telling you what's gone wrong.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm starting this discussion after spending 2 hours debugging 404s in my API routes before I realised I called my API handler
api.tsx
instead ofapi.ts
.It would've been nice if the dev server noticed these sorts of mistakes, as the same can happen with
ssr.ts
instead ofssr.tsx
(as that file supports JSX but doesn't use it as of the boilerplate, so there's no indication of the mistake)I can see this particular problem fixed by either:
.tsx
for all of them (API is the only one that doesn't for now)Regardless, I'd also make this a larger discussion about other ways the folder structure can be set up incorrectly and the dev server can help with warnings (e.g. using API routes without initialising the API handler; exporting a fileRoute from a non-route file - both of these can be detected by watching exports under
routes
)I can see these sorts of issues coming up waay less after a Tanstack Start CLI is implemented since it'll be taking care of setting up all the boilerplate. Still, I think on the long run these problems could continue happening and right now they are a nightmare to debug as there's literally nothing telling you what's gone wrong.
Beta Was this translation helpful? Give feedback.
All reactions