diff --git a/superset/assets/src/visualizations/deckgl/CategoricalDeckGLContainer.jsx b/superset/assets/src/visualizations/deckgl/CategoricalDeckGLContainer.jsx index be30aad60..e1933a4b1 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);