Skip to content

Commit fbfe638

Browse files
committed
prune global-level trace attributes that are already defined in a trace
1 parent fdcdd22 commit fbfe638

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/plot_api/plot_schema.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -460,11 +460,22 @@ function getTraceAttributes(type) {
460460
// make 'type' the first attribute in the object
461461
attributes.type = null;
462462

463+
464+
var copyBaseAttributes = extendDeepAll({}, baseAttributes),
465+
copyModuleAttributes = extendDeepAll({}, _module.attributes);
466+
467+
// prune global-level trace attributes that are already defined in a trace
468+
exports.crawl(copyModuleAttributes, function(attr, attrName, attrs, level, fullAttrString) {
469+
delete copyBaseAttributes[fullAttrString];
470+
// Prune undefined attributes
471+
if(attr === undefined) delete copyModuleAttributes[fullAttrString];
472+
});
473+
463474
// base attributes (same for all trace types)
464-
extendDeepAll(attributes, baseAttributes);
475+
extendDeepAll(attributes, copyBaseAttributes);
465476

466477
// module attributes
467-
extendDeepAll(attributes, _module.attributes);
478+
extendDeepAll(attributes, copyModuleAttributes);
468479

469480
// subplot attributes
470481
if(basePlotModule.attributes) {

0 commit comments

Comments
 (0)