Closed tempoeric closed 8 months ago
@sergiodxa can you help me with this?
There are 2 separate issues here:
<Form>
was submitting to a non-existent /login
route via action="/login"
- removing that allows the form to be submitted to the current route action
error
or errors
didn't exist. So typescript cannot be sure which return pat hwas taken so it is forcing you to use type narrowing. The best solution for this IMO is to use a consistent return shape and put error: null
or errors: null
in the cases they don't applyHere's a working example! https://stackblitz.com/edit/remix-run-remix-r3ndfy?file=app%2Froutes%2Fhome.child.tsx,package.json,tailwind.config.ts,app%2Froutes%2F_index.tsx
Reproduction
https://stackblitz.com/edit/remix-run-remix-aagfjb?file=app%2Froutes%2Fhome.child.tsx,package.json,tailwind.config.ts,app%2Froutes%2Fhome.tsx
System Info
Used Package Manager
npm
Expected Behavior
should be able to log the errors or fetch from actionData
Actual Behavior
unable to fetch formErrors or fieldErrors in formData using useActionData() try to uncomment line 98 and 99 in home.child.tsx you should be able to get errors and fields using actionData but it causes error