Skip to content

Commit 77383de

Browse files
Move deep copy inside fillCustomButton function.
1 parent 8c2ea1c commit 77383de

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

draftlogs/6177_fix.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
- Fix modeBarButtons mutate the input, issue [[#1157](https://github.com/plotly/dash/issues/1157)]
1+
- Fix custom modebar buttons mutate the input [[#6177](https://github.com/plotly/plotly.js/pull/6177)]

src/components/modebar/manage.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ module.exports = function manageModeBar(gd) {
4545
].join(' '));
4646
}
4747

48-
var customButtons = extendDeep([], context.modeBarButtons);
48+
var customButtons = context.modeBarButtons;
4949
var buttonGroups;
5050

5151
if(Array.isArray(customButtons) && customButtons.length) {
@@ -331,7 +331,9 @@ function appendButtonsToGroups(groups, buttons) {
331331
}
332332

333333
// fill in custom buttons referring to default mode bar buttons
334-
function fillCustomButton(customButtons) {
334+
function fillCustomButton(originalModeBarButtons) {
335+
var customButtons = extendDeep([], originalModeBarButtons);
336+
335337
for(var i = 0; i < customButtons.length; i++) {
336338
var buttonGroup = customButtons[i];
337339

0 commit comments

Comments
 (0)