Skip to content

'r.scatter2d.destroy is not a function' error when updating a plot using scattergl and Plotly.react #3004

@rhamner

Description

@rhamner

I am getting

'Uncaught TypeError: r.scatter2d.destroy is not a function
at Object.E.e._scene.r.destroy (plotly.min.js:7)
at Object.r.clean (plotly.min.js:7)
at Object.v.cleanPlot (plotly.min.js:7)
at e (plotly.min.js:7)
at Object.l.syncOrAsync (plotly.min.js:7)
at r.plot (plotly.min.js:7)
at Object.l.syncOrAsync (plotly.min.js:7)
at Object.r.react (plotly.min.js:7)'

when trying to update a plot with new data using Plotly.react. I have a codepen that reproduces it:

https://codepen.io/rhamner/pen/GXdzLg

What should happen in the codepen is:

  • first plot shows data set 2
  • second plot shows data set 1 for 5 seconds, then data set 2, then data set 1 again

Instead, it stays on data set 1 and throws the error above. I thought at first data set 2 was bad, but the first plot seems to work just fine and it's identical data. Further, after throwing that error, even trying to plot the original data seems to fail.

Switching to Plotly.newPlot seems to work fine, but it's quite slow so I would really like to avoid that.

This is plotly.js 1.40.1 and I am using chrome. It also happens with firefox for me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions