Skip to content

Commit

Permalink
fix(deck.gl): update view state on property changes (#17720) (#17826)
Browse files Browse the repository at this point in the history
* Update viewstate on property changes

* Compare props via isEqual
  • Loading branch information
hbruch authored Feb 11, 2022
1 parent 7c69a1b commit 97d918b
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*/
import React from 'react';
import PropTypes from 'prop-types';
import { isEqual } from 'lodash';
import { StaticMap } from 'react-map-gl';
import DeckGL from 'deck.gl';
import { styled } from '@superset-ui/core';
Expand Down Expand Up @@ -63,6 +64,12 @@ export class DeckGLContainer extends React.Component {
};
}

UNSAFE_componentWillReceiveProps(nextProps) {
if (!isEqual(nextProps.viewport, this.props.viewport)) {
this.setState({ viewState: nextProps.viewport });
}
}

componentWillUnmount() {
clearInterval(this.state.timer);
}
Expand Down

0 comments on commit 97d918b

Please sign in to comment.