question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property '_rehover'

See original GitHub issue

I’m leveraging react-plotly for a project and getting the following error,

Error while plotting: TypeError: Cannot read property '_rehover' of undefined
    at push../node_modules/plotly.js/src/plots/plots.js.plots.rehover (plots.js:2814)
    at Object.push../node_modules/plotly.js/src/lib/index.js.lib.syncOrAsync (index.js:413)
    at continueAsync (index.js:408)

That line of code is:

plots.rehover = function (gd) {
  if (gd._fullLayout._rehover) {
    gd._fullLayout._rehover();
  }
};

I’m not sure if this is a react-plotly.js or regular plotly.js issue, since the code it’s erroring on is regular plotly.js code. It seems that plots.rehover is being called after the plot has been unmounted (that is purge has already been called).

Am I doing something wrong?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
etpinardcommented, Apr 24, 2019

I’m not sure how this can happen (a reproducible example could help 😏 ), but it would be easy to add an additional safe-guard in rehover:

plots.rehover = function (gd) {
  var fullLayout = gd._fullLayout;
  if(fullLayout && fullLayout._rehover) {
    fullLayout._rehover();
  }
};
0reactions
gonzofishcommented, Apr 25, 2019

Ok, so it absolutely (as per usual) was my code causing this to happen, so it might not be worth the effort.

In my code an async request to the server updates a Redux state which updates a parent component of my react-plotly component. At the same time, though, it starts unmounting everything to change pages, so as plotly is trying to re-render, I’m destroying everything. I suppose by the time the _rehover function tries to be executed (as a result of the re-render), Plotly has probably purged the graph div of all its Plotly attributes (as a result of the unmounting).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting state in OnMouseOver event returns TypeError ...
MyClass.js:265 Uncaught TypeError: Cannot read property 'reserved' of undefined at MyClass._this._onRenderCell.
Read more >
Dash app with js clientside callback sometimes crashes
... TypeError: Cannot read property '_subplot' of undefined at ... at v.rehover (plotly-1.49.4.min.js?v=1.2.0&m=1570107433:7) at Object.l.
Read more >
React/Redux Render Error: 'TypeError: Cannot read property ...
Trying to access a property of null throws 'Uncaught TypeError: Cannot read property [propertyName] of null'. Instead of the status value ...
Read more >
Solved: Hover Label in interactive html - JMP User Community
Solved: I have defined a column as label, because I want to see the data in my standard graphs. But I don't want...
Read more >
In Re Hover Motors, 217 P.2d 863, 121 Colo. 439
"Section 6. Section 54, of Chapter 142, 1935 Colorado Statutes Annotated, is hereby amended to read as follows: "Section 54. Average of Merchandise...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found