remix-run / remix

Build Better Websites. Create modern, resilient user experiences with web fundamentals.
https://remix.run
MIT License
29.65k stars 2.5k forks source link

useActionData cannot get formError or fieldErrors #8601

Closed tempoeric closed 8 months ago

tempoeric commented 8 months ago

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

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.14.0 - /usr/local/bin/pnpm

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

tempoeric commented 8 months ago

@sergiodxa can you help me with this?

brophdawg11 commented 8 months ago

There are 2 separate issues here:

Here'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