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.

Error while plotting after React update

See original GitHub issue

Under certain circumstances, after a React update, the <Plot ../> component will throw the following error:

factory.js:131 Error while plotting: Error: DOM element provided is null or undefined
    at Object../node_modules/plotly.js/src/lib/get_graph_div.js.module.exports [as getGraphDiv] (get_graph_div.js:32)
    at Object../node_modules/plotly.js/src/plot_api/plot_api.js.Plotly.react (plot_api.js:2222)
    at factory.js:107
    at <anonymous>

I added some logging into factory.js to try and debug (modified factory.js attached below). Here’s the output:

screen shot 2018-02-25 at 5 09 02 pm

My hypothesis is that if Reacts attempts to update the component quickly enough, the promise scheduled in willComponentUpdate (https://github.com/plotly/react-plotly.js/blob/master/src/factory.js#L100) may be called after React calls getRef with null and before it gets called again with the newly rendered div.


Chrome 64.0.3282.167 Mac
plotly.js 1.34.0
react-plotly.js 1.6.0

factory.js.txt

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:10
  • Comments:32 (10 by maintainers)

github_iconTop GitHub Comments

5reactions
ArcticTeecommented, Nov 28, 2018

Bump

4reactions
nicolaskruchtencommented, Feb 27, 2018

Thanks for the bug report! I’ll try to replicate and add some guards here so that we don’t try to render on a null ref 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

React mapping is suddenly showing error, which was working ...
So for a while it worked fine in create-react-app. But when after I build the project all the map() functions are showing error....
Read more >
NetLogo 6.3.0 User Manual: Programming Guide
Use the reset-ticks command when your model is done setting up, to start the tick counter. If your model is set to use...
Read more >
Test Renderer - React
This simulates a React update at the root. If the new element has the same type and key as the previous element, the...
Read more >
Using Plotly in React to build dynamic charts and graphs
Learn how to build and display dynamic and customizable graphs in your React applications with Plotly, a data visualization framework.
Read more >
Matplotlib Plotting - W3Schools
Example. Draw a line in a diagram from position (1, 3) to position (8, 10):. import matplotlib.pyplot ...
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