You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2022/02/11 11:21:42 UTC

[superset] branch master updated: fix(deck.gl): update view state on property changes (#17720) (#17826)

This is an automated email from the ASF dual-hosted git repository.

villebro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 97d918b  fix(deck.gl): update view state on property changes (#17720) (#17826)
97d918b is described below

commit 97d918b6927f572dca3b33c61b89c8b3ebdc4376
Author: Holger Bruch <hb...@mfdz.de>
AuthorDate: Fri Feb 11 12:19:42 2022 +0100

    fix(deck.gl): update view state on property changes (#17720) (#17826)
    
    * Update viewstate on property changes
    
    * Compare props via isEqual
---
 .../plugins/legacy-preset-chart-deckgl/src/DeckGLContainer.jsx     | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/DeckGLContainer.jsx b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/DeckGLContainer.jsx
index 133d833..53c6f73 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/DeckGLContainer.jsx
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/DeckGLContainer.jsx
@@ -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';
@@ -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);
   }