Skip to content

Commit

Permalink
handle the case of unregistered scatter
Browse files Browse the repository at this point in the history
  • Loading branch information
archmoj committed Mar 9, 2021
1 parent faef2bb commit b0766a7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/plot_api/plot_schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,13 @@ exports.getTraceValObject = function(trace, parts) {
// first look in the module for this trace
// components have already merged their trace attributes in here
var _module = trace._module;
if(!_module) _module = (Registry.modules[trace.type || baseAttributes.type.dflt] || {})._module;
if(!_module) _module = (Registry.modules[trace.type] || {})._module;
if(!_module) {
var scatter = Registry.modules[baseAttributes.type.dflt];
if(scatter) {
_module = scatter._module;
}
}
if(!_module) return false;

moduleAttrs = _module.attributes;
Expand Down
10 changes: 8 additions & 2 deletions src/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var isPlainObject = require('./lib/is_plain_object');
var addStyleRule = require('./lib/dom').addStyleRule;
var ExtendModule = require('./lib/extend');

var basePlotAttributes = require('./plots/attributes');
var dfltTrace = require('./plots/attributes').type.dflt;
var baseLayoutAttributes = require('./plots/layout_attributes');

var extendFlat = ExtendModule.extendFlat;
Expand Down Expand Up @@ -140,7 +140,13 @@ exports.traceIs = function(traceType, category) {
Loggers.log('Unrecognized trace type ' + traceType + '.');
}

_module = exports.modules[basePlotAttributes.type.dflt];
_module = exports.modules[dfltTrace];
if(!_module) {
Loggers.log('The default trace type ' + dfltTrace + ' is not registered.');

// in case the category starts with no return true otherwise false
return category.indexOf('no') === 0 ? true : false;
}
}

return !!_module.categories[category];
Expand Down

0 comments on commit b0766a7

Please sign in to comment.