Skip to content

Commit

Permalink
fix(fieldArray-focus): add logic to not auto focus when fieldarray is…
Browse files Browse the repository at this point in the history
… first added
  • Loading branch information
jdinh8124 authored Sep 24, 2024
1 parent 4b3c76e commit 4a2a735
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion react-app/src/components/RHF/FieldArray.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ export const RHFFieldArray = <TFields extends FieldValues>(

useEffect(() => {
if (fieldArr.fields.length) return;
fieldArr.append(props.fields.reduce(slotInitializer(), {}) as never);
fieldArr.append(props.fields.reduce(slotInitializer(), {}) as never, {
shouldFocus: false,
});
}, [fieldArr, props.fields]);

return (
Expand Down

0 comments on commit 4a2a735

Please sign in to comment.