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

Update value if any element of the array changes #139

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

johnwalley
Copy link
Owner

@johnwalley johnwalley commented Jul 10, 2020

Attempt to address #138.

Previously we were only checking if the first two elements of the value array had changed. If no change was found then value was not updated.

value[0] !== newValue[0] ||
(value.length > 1 && value[1] !== newValue[1])
value.some(function (d, i) {
return d !== newValue[i];
Copy link
Owner Author

Choose a reason for hiding this comment

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

This isn't correct if newValue is shorter than value. Perhaps we could check if the arrays are the same length first? If they differ in length then we skip the check and always update.

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.

1 participant