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
1 change: 1 addition & 0 deletions src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,7 @@ Plotly.redraw = function(gd) {
Plotly.newPlot = function (gd, data, layout, config) {
gd = getGraphDiv(gd);
plots.purge(gd);
gd.removeAllListeners();
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd would put this in plots.purge

and maybe (cc @alexcjohnson ) we could expose purge on Plotly? It sounds to me like something users might want to use.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call on moving removeAllListeners. Not sure if we should expose the purge method though - I can't think of too many use cases where that's what a user would want to clear the node and reuse it - if they want to "purge", they'll just delete the node. Better to keep the user surface area of plotly.js as small as possible.

@alexcjohnson thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

@mdtusz

if they want to "purge", they'll just delete the node.

You got me convinced 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

purge it all

return Plotly.plot(gd, data, layout, config);
};

Expand Down