Skip to content

Commit

Permalink
Revert "fix useless resynchronisation when range isn’t used": this
Browse files Browse the repository at this point in the history
is most likely (part of) the #1011 cause

This reverts commit 3034672.
  • Loading branch information
mirabilos committed Feb 7, 2023
1 parent 3034672 commit e854c3d
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/extras/synchronizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,8 @@ var synchronize = function(/* dygraphs..., opts */) {
};
};

function arraysAreEqualOrBothNULL(a, b) {
if (a === null && b === null)
return true;
if (!Array.isArray(a) || !Array.isArray(b))
return false;
function arraysAreEqual(a, b) {
if (!Array.isArray(a) || !Array.isArray(b)) return false;
var i = a.length;
if (i !== b.length) return false;
while (i--) {
Expand All @@ -180,9 +177,9 @@ function attachZoomHandlers(gs, syncOpts, prevCallbacks) {
if (block || initial) return;
block = true;
var opts = {
valueRange: syncOpts.range ? me.yAxisRange() : null,
dateWindow: me.xAxisRange()
};
if (syncOpts.range) opts.valueRange = me.yAxisRange();

for (var j = 0; j < gs.length; j++) {
if (gs[j] == me) {
Expand All @@ -193,8 +190,8 @@ function attachZoomHandlers(gs, syncOpts, prevCallbacks) {
}

// Only redraw if there are new options
if (arraysAreEqualOrBothNULL(opts.dateWindow, gs[j].getOption('dateWindow')) &&
arraysAreEqualOrBothNULL(opts.valueRange, gs[j].getOption('valueRange'))) {
if (arraysAreEqual(opts.dateWindow, gs[j].getOption('dateWindow')) &&
arraysAreEqual(opts.valueRange, gs[j].getOption('valueRange'))) {
continue;
}

Expand Down

0 comments on commit e854c3d

Please sign in to comment.