Skip to content

Plots.supplyDeffaults subplot type cache doesn't allow dynamic trace module imports #3428

Closed
@dan8f

Description

@dan8f

Hi team,

collectableSubplotTypes gets cached and this leads to inaccurate subplot lists if new traces are registered dynamically:

var collectableSubplotTypes;
function emptySubplotLists() {
var out = {};
var i, j;
if(!collectableSubplotTypes) {
collectableSubplotTypes = [];
var subplotsRegistry = Registry.subplotsRegistry;
for(var subplotType in subplotsRegistry) {
var subplotModule = subplotsRegistry[subplotType];
var subplotAttr = subplotModule.attr;
if(subplotAttr) {
collectableSubplotTypes.push(subplotType);
// special case, currently just for cartesian:
// we need to enumerate axes, not just subplots
if(Array.isArray(subplotAttr)) {
for(j = 0; j < subplotAttr.length; j++) {
Lib.pushUnique(collectableSubplotTypes, subplotAttr[j]);
}
}
}
}
}
for(i = 0; i < collectableSubplotTypes.length; i++) {
out[collectableSubplotTypes[i]] = [];
}
return out;
}

For example if we load Plotly, plot a graph and later dynamically register mapbox and plot a mapbox it will error since coorect subplotTypes are not passed to handleSubplotDefaults.

Could we simply not cache subplotTypes or reset when we register new traces?

Regards

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions