Skip to content

Commit

Permalink
Move deep copy inside fillCustomButton function.
Browse files Browse the repository at this point in the history
  • Loading branch information
nickmelnikov82 committed May 9, 2022
1 parent 8c2ea1c commit 77383de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion draftlogs/6177_fix.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- Fix modeBarButtons mutate the input, issue [[#1157](https://github.com/plotly/dash/issues/1157)]
- Fix custom modebar buttons mutate the input [[#6177](https://github.com/plotly/plotly.js/pull/6177)]
6 changes: 4 additions & 2 deletions src/components/modebar/manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = function manageModeBar(gd) {
].join(' '));
}

var customButtons = extendDeep([], context.modeBarButtons);
var customButtons = context.modeBarButtons;
var buttonGroups;

if(Array.isArray(customButtons) && customButtons.length) {
Expand Down Expand Up @@ -331,7 +331,9 @@ function appendButtonsToGroups(groups, buttons) {
}

// fill in custom buttons referring to default mode bar buttons
function fillCustomButton(customButtons) {
function fillCustomButton(originalModeBarButtons) {
var customButtons = extendDeep([], originalModeBarButtons);

for(var i = 0; i < customButtons.length; i++) {
var buttonGroup = customButtons[i];

Expand Down

0 comments on commit 77383de

Please sign in to comment.