Skip to content

Commit

Permalink
Change to join values together rather than use length
Browse files Browse the repository at this point in the history
as this ensures if the size doesn't change, but the values do the update fires

Co-authored-by: Gildas Garcia <1122076+djhi@users.noreply.github.com>
  • Loading branch information
helenwilliamson and djhi committed Aug 4, 2020
1 parent 45bda72 commit ba7f0d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ describe('<AutocompleteArrayInput />', () => {
expect(setFilter).toHaveBeenCalledWith('p');
formApi.change('tags', ['p']);
await waitForDomChange();
expect(setFilter).toHaveBeenCalledTimes(2);
expect(setFilter).toHaveBeenCalledTimes(3);
expect(setFilter).toHaveBeenCalledWith('');
});

Expand Down Expand Up @@ -432,7 +432,7 @@ describe('<AutocompleteArrayInput />', () => {
expect(setFilter).toHaveBeenCalledWith('p');
formApi.change('tags', ['p']);
await waitForDomChange();
expect(setFilter).toHaveBeenCalledTimes(2);
expect(setFilter).toHaveBeenCalledTimes(3);
expect(setFilter).toHaveBeenCalledWith('');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ const AutocompleteArrayInput: FunctionComponent<
// would have to first clear the input before seeing any other choices
useEffect(() => {
handleFilterChange('');
}, [values.length, handleFilterChange]);
}, [values.join(','), handleFilterChange]);

const handleKeyDown = useCallback(
(event: React.KeyboardEvent) => {
Expand Down

0 comments on commit ba7f0d3

Please sign in to comment.