Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to use length of values with useEffect in AutocompleteArrayInput #5044

Merged
merged 3 commits into from
Aug 4, 2020

Conversation

helenwilliamson
Copy link
Contributor

@helenwilliamson helenwilliamson commented Jul 13, 2020

as if you spread values when this is nothing in values, the second parameter to useEffect will have 1 entry.
when there is a something in values, the second parameter to useEffect will have 2 entries. By using lenghth,
there are always 2 entries in the array

Closes #4724

as if you spread values when this is nothing in values, the array passed to useEffect will have 1 entry.
when there is a something in values, the array passed to useEffect will have 2 entries. By using lenghth,
there are always 2 entries in the array
as this will ensure the second parameter to useMemo is consistent in length
@Luwangel Luwangel requested a review from djhi July 15, 2020 13:54
Copy link
Contributor

@djhi djhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I was in vacations :) Thanks for the contribution!

Copy link
Contributor

@djhi djhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@djhi djhi added this to the 3.7.2 milestone Aug 4, 2020
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>
@Luwangel Luwangel changed the title Change to use length of values with useEffect Change to use length of values with useEffect in AutocompleteArrayInput Aug 4, 2020
@Luwangel Luwangel merged commit a99ea2d into marmelab:master Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AutocompleteArrayInput wrong behavior on input changes
3 participants