You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As @etpinard pointed out during the finance refactor PR #2561 (comment) and #2561 (comment) we have a mess when redrawing cartesian SVG traces, both re: deleting and redrawing existing traces and re: removing completely unused modules.
The first part we can handle by making all the trace modules support more d3-idiomatic enter/exit/each logic as suggested in this TODO. The second has a few ways to go about it. Quoting @etpinard:
What we need to do is find all the gone modules (i.e. modules with had??=true and has??=false), loop over them, and then do what we need to do the cleanup the DOM.
Better yet -- as more and more trace type will follow scatter and ohlc in not expecting a selectAll('g.trace').remove() before each _module.plot() -- we could add a trace module method (maybe called cleanDOM) to each trace modules that need to remove things for the DOM (or destroy WebGL objects).
To note, geo subplots (and maybe others?) solve this problem in a different way by using Plots.generalUpdatePerTraceModule which calls _module.plot of visible andgone modules and expects the trace module plot methods to clean up the DOM accordingly (e.g. like here for choropleth traces). At present though, I think adding cleanDOM to each trace module would be best, as it would allow us to handle the scattergl and range-slider cases more easily.
The text was updated successfully, but these errors were encountered:
Another idea about this: create and remove the trace layers ('g.scatterlayer' etc) using a d3-idiomatic pattern based on the actual traces present in each subplot. Then we won't have to look at the old module list at all, d3 will just look at the DOM and remove the no-longer-needed layers. As a bonus then we won't need to make all those empty containers in the first place!
As @etpinard pointed out during the finance refactor PR #2561 (comment) and #2561 (comment) we have a mess when redrawing cartesian SVG traces, both re: deleting and redrawing existing traces and re: removing completely unused modules.
The first part we can handle by making all the trace modules support more d3-idiomatic
enter/exit/each
logic as suggested in this TODO. The second has a few ways to go about it. Quoting @etpinard:The text was updated successfully, but these errors were encountered: