Error while plotting after React update
See original GitHub issueUnder 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:
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
Issue Analytics
- State:
- Created 6 years ago
- Reactions:10
- Comments:32 (10 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Bump
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 😃