From a09348d0ec27463a394d9914dcd5cbfd5670a5ee Mon Sep 17 00:00:00 2001 From: Beto Dealmeida Date: Thu, 31 Jan 2019 17:23:59 -0800 Subject: [PATCH] Fix playslider --- .../visualizations/deckgl/CategoricalDeckGLContainer.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/superset/assets/src/visualizations/deckgl/CategoricalDeckGLContainer.jsx b/superset/assets/src/visualizations/deckgl/CategoricalDeckGLContainer.jsx index be30aad605ac0..e1933a4b1b50e 100644 --- a/superset/assets/src/visualizations/deckgl/CategoricalDeckGLContainer.jsx +++ b/superset/assets/src/visualizations/deckgl/CategoricalDeckGLContainer.jsx @@ -70,7 +70,7 @@ export default class CategoricalDeckGLContainer extends React.PureComponent { */ constructor(props) { super(props); - this.state = this.getInitialStateFromProps(props); + this.state = this.getStateFromProps(props); this.getLayers = this.getLayers.bind(this); this.onValuesChange = this.onValuesChange.bind(this); @@ -78,6 +78,11 @@ export default class CategoricalDeckGLContainer extends React.PureComponent { this.toggleCategory = this.toggleCategory.bind(this); this.showSingleCategory = this.showSingleCategory.bind(this); } + componentWillReceiveProps(nextProps) { + if (nextProps.payload.form_data !== this.state.formData) { + this.setState({ ...this.getStateFromProps(nextProps) }); + } + } onValuesChange(values) { this.setState({ values: Array.isArray(values) @@ -88,7 +93,7 @@ export default class CategoricalDeckGLContainer extends React.PureComponent { onViewportChange(viewport) { this.setState({ viewport }); } - getInitialStateFromProps(props, state) { + getStateFromProps(props, state) { const features = props.payload.data.features || []; const timestamps = features.map(f => f.__timestamp); const categories = getCategories(props.formData, features);