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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,9 @@ function slider(orientation, scale) {

function updateValue(newValue, notifyListener) {
if (
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.

})
) {
value = newValue;

Expand Down