Skip to content

Commit

Permalink
array fields add and remove now trigger onValueSet
Browse files Browse the repository at this point in the history
  • Loading branch information
joepuzzo committed Nov 1, 2022
1 parent 99cd02f commit 9bd4d00
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.36.0 (Nov 1st, 2022)

- array fields add and remove now trigger onValueSet

## 4.35.2 (Oct 26th, 2022)

- multistep type improvements
Expand Down
2 changes: 2 additions & 0 deletions src/hooks/useArrayField.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const useArrayField = ({
// We need to manually do a pull from the form state
formController.pullOut(`${name}[${i}]`);
formApi.setDirt(name, []);
formController.emitter.emit('field-value-set', name);
};

const swap = (a, b) => {
Expand Down Expand Up @@ -127,6 +128,7 @@ export const useArrayField = ({
// If we added a new field we are no longer pristine
formApi.setPristine(false);
formApi.setDirt(name, []);
formController.emitter.emit('field-value-set', name);
};

const addWithInitialValue = initialValue => {
Expand Down

0 comments on commit 9bd4d00

Please sign in to comment.