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

Commit

Permalink
Clone figure.layout in Graph (regression fix)
Browse files Browse the repository at this point in the history
  • Loading branch information
valentijnnieman committed Sep 18, 2018
1 parent c82bea0 commit 7b48b18
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dash_core_components/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 7 additions & 9 deletions src/components/Graph.react.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {contains, filter, has, isNil, type} from 'ramda';
import {contains, filter, clone, has, isNil, type} from 'ramda';
/* global Plotly:true */

const filterEventData = (gd, eventData, event) => {
Expand Down Expand Up @@ -77,15 +77,13 @@ export default class PlotlyGraph extends Component {
if (animate && this._hasPlotted && figure.data.length === gd.data.length) {
return Plotly.animate(id, figure, animation_options);
}
return Plotly.react(id, figure.data, figure.layout, config).then(
() => {
if (!this._hasPlotted) {
this.bindEvents();
Plotly.Plots.resize(document.getElementById(id));
this._hasPlotted = true;
}
return Plotly.react(id, figure.data, clone(figure.layout), config).then(() => {
if (!this._hasPlotted) {
this.bindEvents();
Plotly.Plots.resize(document.getElementById(id));
this._hasPlotted = true;
}
);
});
}

bindEvents() {
Expand Down

0 comments on commit 7b48b18

Please sign in to comment.