react-hook-form / react-hook-form

📋 React Hooks for form state management and validation (Web + React Native)
https://react-hook-form.com
MIT License
41.34k stars 2.07k forks source link

issue: Field with useController inside useFieldArray not update #11931

Closed andreyevyk closed 4 months ago

andreyevyk commented 4 months ago

Version Number

7.51.5

Codesandbox/Expo snack

https://codesandbox.io/p/sandbox/naughty-poitras-m62j7v

Steps to reproduce

  1. Go to the codesandbox link
  2. Click on 'Update Object'
  3. The Fields stringified will update, but the Controlled Field will not

Expected behaviour

The controlled Field must updates. Before this commit, the controlled is updated when fields update. Old version sandbox.

This happens due to the use of exact: true.

What browsers are you seeing the problem on?

Chrome, Edge

Relevant log output

No response

Code of Conduct

bluebill1049 commented 4 months ago

not a valid use case, plz refer to the doc.

intayush commented 4 months ago

@bluebill1049 I'm facing a similar issue. Do you mean to say that the field array state is not supposed to be in sync with control by design? Would be helpful if you could expand a bit on it or point to the part of docs you have asked to refer. Thanks :)

andreyevyk commented 4 months ago

@bluebill1049 The usecontroller is not synchronized within a FieldArray, I didn't find this in the documentation, can you explain more?

BrendanC23 commented 4 months ago

Bump.

jmunozz commented 3 months ago

Can you explain why this issue is not valid ? How am I supposed to update a field from within a FieldArray field ? Doc mentions update() method and a classic Controllerone:

            <Controller
              render={({ field }) => <input {...field} />}
              name={`test.${index}.lastName`}
              control={control}
            />