Skip to content

Commit 24e5acc

Browse files
Simplifying the plotly update frames code.
Co-authored-by: Alex Johnson <[email protected]>
1 parent 93df047 commit 24e5acc

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

components/dash-core-components/src/fragments/Graph.react.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,12 @@ class PlotlyGraph extends Component {
156156
) {
157157
// in case we've have figure frames,
158158
// we need to recreate frames before animation
159-
let result;
160159
if (figure.frames) {
161-
result = Plotly.deleteFrames(gd).then(() => {
162-
return Plotly.addFrames(gd, figure.frames).then(() => {
163-
return Plotly.animate(gd, figure, animation_options);
164-
});
165-
});
166-
} else {
167-
result = Plotly.animate(gd, figure, animation_options);
160+
return Plotly.deleteFrames(gd)
161+
.then(() => Plotly.addFrames(gd, figure.frames))
162+
.then(() => Plotly.animate(gd, figure, animation_options));
168163
}
169-
return result;
164+
return Plotly.animate(gd, figure, animation_options);
170165
}
171166

172167
const configClone = this.getConfig(config, responsive);

0 commit comments

Comments
 (0)