Skip to content

Commit

Permalink
Keep errors and other state on ArrayInput unmount
Browse files Browse the repository at this point in the history
  • Loading branch information
sweco-sedalh committed Feb 23, 2024
1 parent 5e2ed7d commit 004e945
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,12 @@ export const ArrayInput = (props: ArrayInputProps) => {
formGroups.registerField(source, formGroupName);

return () => {
unregister(source, { keepValue: true });
unregister(source, {
keepValue: true,
keepError: true,
keepDirty: true,
keepTouched: true,
});
formGroups.unregisterField(source, formGroupName);
};
}, [register, unregister, source, formGroups, formGroupName]);
Expand Down

0 comments on commit 004e945

Please sign in to comment.