Black Lives Matter. Please consider donating to Black Girls Code today.

Deleting graphs unexpected behavior

Hi, I have a callback in a 3D graph (T-SNE visulaization).

When I click a point in the graph, I add to my layout a div with another graph inside. This new div can be closed via JS.
When I close the graph and I click another data point (or simply hover over data points), browser console says:

plotly-1.38.0.min.js:7 Uncaught Error: No DOM element with id 'my-graph' exists on the page.
    at Object.e.exports [as getGraphDiv] (plotly-1.38.0.min.js:7)
    at r.react (plotly-1.38.0.min.js:7)
    at t.value (bundle.js:26)
    at t.value (bundle.js:26)
    at p.updateComponent (react-dom.min.js:13)
    at p.receiveComponent (react-dom.min.js:13)
    at Object.receiveComponent (react-dom.min.js:14)
    at p._updateRenderedComponent (react-dom.min.js:13)
    at p._performComponentUpdate (react-dom.min.js:13)
    at p.updateComponent (react-dom.min.js:13)

Any suggestions?

I added an empty graph with the id, and now it’s working. Now I have another question. Each time I create and delete a component, next component load time is growing.

how can I delete components on the go? I am unable to find any reference to this kind of issue.