Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
Add (large) upper bound on the number of redraw calls
Browse files Browse the repository at this point in the history
... that Plots.doAutoMargin can trigger.

(cherry picked from commit 631014a)
  • Loading branch information
etpinard authored and petii committed Apr 26, 2022
1 parent 7ff4e2d commit 83f1a36
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -1963,7 +1963,19 @@ plots.doAutoMargin = function(gd) {
} else {
fullLayout._redrawFromAutoMarginCount = 1;
}
return Registry.call('plot', gd);

// Always allow at least one redraw and give each margin-push
// call 3 loops to converge. Of course, for most cases this way too many,
// but let's keep things on the safe side until we fix our
// auto-margin pipeline problems:
// https://github.com/plotly/plotly.js/issues/2704
var maxNumberOfRedraws = 3 * (1 + Object.keys(pushMarginIds).length);

if(fullLayout._redrawFromAutoMarginCount < maxNumberOfRedraws) {
return Registry.call('plot', gd);
} else {
Lib.warn('Too many auto-margin redraws.');
}
}
};

Expand Down

0 comments on commit 83f1a36

Please sign in to comment.