-
-
Notifications
You must be signed in to change notification settings - Fork 144
Don't attempt to resize unmounted graphs #563
Conversation
We probably should remove the resize listener in Do we need this same conditional around the dash-core-components/src/components/Graph.react.js Lines 114 to 115 in 6d945c4
Much less likely, but in principle the plot element could be removed before it finishes drawing and enters that |
In order to do this I moved the resize handler from its anon function into a named function bound in the constructor. |
Looks great, thanks! Given that this is a bugfix, would you mind locking it down with a test? Also changelog I'm 99% convinced the way you did the |
I added an integration test. Before the changes in this PR (failing test): ======================================================================
ERROR: test_unmounted_graph_resize (test.test_integration.Tests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/plotly/Workspace/dash-core-components/test/test_integration.py", line 138, in test_unmounted_graph_resize
raise Exception('browser error logged during test', entry)
Exception: ('browser error logged during test', {'level': 'SEVERE', 'message': 'http://localhost:8050/_dash-component-suites/dash_core_components/plotly-1.47.0.min.js?v=0.48.0&m=1555705071 6:2043297 Uncaught Error: DOM element provided is null or undefined', 'source': 'javascript', 'timestamp': 1560296987995})
----------------------------------------------------------------------
Ran 1 test in 5.934s After:
(no exceptions raised) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it. Thank you! 💃
9ec1a80
to
d481743
Compare
Simple check for a graph element before a resize attempt. Fixes #534.