Skip to content

Commit 7298a0c

Browse files
committed
Cut out unnecessary redraw in legend update
1 parent dd035ef commit 7298a0c

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

src/components/legend/draw.js

+1-14
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ function drawTexts(g, gd) {
399399

400400
var transforms, direction;
401401
var fullInput = legendItem.trace._fullInput || {};
402-
var needsRedraw = false;
403402
var update = {};
404403

405404
// N.B. this block isn't super clean,
@@ -419,7 +418,6 @@ function drawTexts(g, gd) {
419418

420419
if(BLANK_STRING_REGEX.test(origText)) {
421420
carr.remove(legendItem.trace._group);
422-
needsRedraw = true;
423421
} else {
424422
carr.set(legendItem.trace._group, text);
425423
}
@@ -429,18 +427,7 @@ function drawTexts(g, gd) {
429427
update.name = text;
430428
}
431429

432-
var p = Plotly.restyle(gd, update, traceIndex);
433-
434-
// If a groupby label is deleted, it seems like we need another redraw in order
435-
// to restore the label. Otherwise it simply sets this property and the blank
436-
// string is retained.
437-
if(needsRedraw) {
438-
p = p.then(function() {
439-
return Plotly.redraw(gd);
440-
});
441-
}
442-
443-
return p;
430+
return Plotly.restyle(gd, update, traceIndex);
444431
});
445432
}
446433
else text.call(textLayout);

0 commit comments

Comments
 (0)