remix
remix copied to clipboard
Forms submits should default to index.tsx file if <route>.tsx doesn't exist (External requests work this way)
What version of Remix are you using?
1.6.3
Steps to Reproduce
- Create a route as follows:
- api
- v1
- customers
- index.tsx
- customers
- v1
- Try and submit to this route using
useFetcher:
fetcher.submit(null, {action: "/api/v1/customers/", method: "get" })
-
you will notice that the no network request is made (not even a 404)
-
Updating the submit action:
fetcher.submit(null, {action: "/api/v1/customers?index", method: "get" })
OR
changing the route strucuture to this:
- api
- v1
- customers
- customers.tsx
- customers
- v1
Fixes the issue
However this is only an issue inside remix, and is impossible to debug from postman or any other HTTP client (e.g. web browser) on the account that any external requests defaults to index.tsx if customers.tsx doesn't exist
At minimum an error should be displayed inside remix
Expected Behavior
External requests should behave exactly the same as internal submit requests.
Actual Behavior
Submit inside remix behaves differently than external requests with no warning or error.
using the initial route structure and accessing the route /api/v1/customers/ in postman works as expected, however doesn't work inside remix
I'm seeing something similar. When making a POST request with action: '/folder' it errors because root.tsx doesn't export an action. WIthout an action (submit(form, { method: 'post'})) the browser redirects to /folder?index.
Converting this to a Proposal discussion, as per our Development Process.