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 2021/08/16 05:48:53 UTC

[superset] 03/34: fix: Multiple dashboard refresh triggers for the same session (#16094)

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

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

commit cfeb5580b8cbb7fac318b7cefa3479ff3edacaca
Author: Michael S. Molina <70...@users.noreply.github.com>
AuthorDate: Tue Aug 10 09:12:28 2021 -0300

    fix: Multiple dashboard refresh triggers for the same session (#16094)
    
    (cherry picked from commit 07f33998ac681db218960f9875d55bc2fae3352b)
---
 superset-frontend/src/dashboard/components/Header/index.jsx | 6 +++++-
 superset-frontend/src/dashboard/util/setPeriodicRunner.ts   | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/superset-frontend/src/dashboard/components/Header/index.jsx b/superset-frontend/src/dashboard/components/Header/index.jsx
index 7069954..3b93485 100644
--- a/superset-frontend/src/dashboard/components/Header/index.jsx
+++ b/superset-frontend/src/dashboard/components/Header/index.jsx
@@ -48,7 +48,9 @@ import {
   SAVE_TYPE_OVERWRITE,
   DASHBOARD_POSITION_DATA_LIMIT,
 } from 'src/dashboard/util/constants';
-import setPeriodicRunner from 'src/dashboard/util/setPeriodicRunner';
+import setPeriodicRunner, {
+  stopPeriodicRender,
+} from 'src/dashboard/util/setPeriodicRunner';
 import { options as PeriodicRefreshOptions } from 'src/dashboard/components/RefreshIntervalModal';
 
 const propTypes = {
@@ -196,6 +198,8 @@ class Header extends React.PureComponent {
   }
 
   componentWillUnmount() {
+    stopPeriodicRender(this.refreshTimer);
+    this.props.setRefreshFrequency(0);
     clearTimeout(this.ctrlYTimeout);
     clearTimeout(this.ctrlZTimeout);
   }
diff --git a/superset-frontend/src/dashboard/util/setPeriodicRunner.ts b/superset-frontend/src/dashboard/util/setPeriodicRunner.ts
index e0207e8..c5177ed 100644
--- a/superset-frontend/src/dashboard/util/setPeriodicRunner.ts
+++ b/superset-frontend/src/dashboard/util/setPeriodicRunner.ts
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-const stopPeriodicRender = (refreshTimer?: number) => {
+export const stopPeriodicRender = (refreshTimer?: number) => {
   if (refreshTimer) {
     clearInterval(refreshTimer);
   }