Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Issue 681 - Upgrade plotly.js to 1.50.1 #682

Merged
merged 6 commits into from
Oct 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Updated
- Upgraded plotly.js to 1.50.1 [#681](https://github.com/plotly/dash-core-components/issues/681)
- Patch release [1.50.1](https://github.com/plotly/plotly.js/releases/tag/v1.50.1) containing several bug fixes.

### Fixed
- [#681](https://github.com/plotly/dash-core-components/issues/681) Fix a bug with the dcc.Graph component logging errors in certain circumstances when nested inside a dcc.Loading component

## [1.3.0] - 2019-10-08
### Added
- Added `search_value` prop to `Dropdown`, for server-side options loading/filtering. [#660](https://github.com/plotly/dash-core-components/pull/660)
Expand Down
4 changes: 2 additions & 2 deletions dash_core_components_base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@

_js_dist = [
{
'external_url': 'https://cdn.plot.ly/plotly-1.50.0.min.js',
'relative_package_path': 'plotly-1.50.0.min.js',
'external_url': 'https://cdn.plot.ly/plotly-1.50.1.min.js',
'relative_package_path': 'plotly-1.50.1.min.js',
'namespace': 'dash_core_components'
},
{
Expand Down

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/components/Graph.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ class PlotlyGraph extends Component {
const gd = this.gd.current;
if (gd && gd.removeAllListeners) {
gd.removeAllListeners();
Plotly.purge(gd);
if (this._hasPlotted) {
Plotly.purge(gd);
}
}
window.removeEventListener('resize', this.graphResize);
}
Expand Down
45 changes: 45 additions & 0 deletions tests/integration/graph/test_graph_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,48 @@ def selected_df_figure(selection):
# but that's what we had as of the 608 fix, PR 621, so let's lock that
# in for now.
assert call_count.value == 2


@pytest.mark.DCC672
def test_grbs002_graph_wrapped_in_loading_component_does_not_fail(dash_dcc):
app = dash.Dash(__name__, suppress_callback_exceptions=True)
app.layout = html.Div([
html.H1('subplot issue'),
dcc.Location(id='url', refresh=False),
dcc.Loading(id="page-content")
])

@app.callback(Output('page-content', 'children'), [Input('url', 'value')])
def render_page(url):
return [
dcc.Dropdown(
id='my-dropdown',
options=[
{'label': 'option 1', 'value': '1'},
{'label': 'option 2', 'value': '2'}
],
value='1'
),
dcc.Graph(id='my-graph')
]

@app.callback(Output('my-graph', 'figure'), [Input('my-dropdown', 'value')])
def update_graph(value):
values = [1, 2, 3]
ranges = [1, 2, 3]

return {
'data': [{
'x': ranges,
'y': values,
'line': {
'shape': 'spline'
}
}],
}

dash_dcc.start_server(app)

dash_dcc.wait_for_element('#my-graph .main-svg')

assert not dash_dcc.get_logs()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure that when rendering a graph as a callback-child of a loading component, no error occurs