Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/modebar/manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var isUnifiedHover = require('../fx/helpers').isUnifiedHover;
var createModeBar = require('./modebar');
var modeBarButtons = require('./buttons');
var DRAW_MODES = require('./constants').DRAW_MODES;
var cloneDeep = require('lodash').cloneDeep;
Copy link
Contributor

@archmoj archmoj May 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much for the PR.
Please note that lodash is a dev-dependency.
And for various reasons (e.g. size & potential security issues) we are not interested to include that in our bundles.
Alternatively you could use

var extendDeep = require('../../lib').extendDeep;

and then

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

Or perhaps even better would be to use extendFlat if possible?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Using the extendFlat function is not possible because the object has a nested structure.


/**
* ModeBar wrapper around 'create' and 'update',
Expand Down Expand Up @@ -44,7 +45,7 @@ module.exports = function manageModeBar(gd) {
].join(' '));
}

var customButtons = context.modeBarButtons;
var customButtons = cloneDeep(context.modeBarButtons);
var buttonGroups;

if(Array.isArray(customButtons) && customButtons.length) {
Expand Down