From 07f33998ac681db218960f9875d55bc2fae3352b Mon Sep 17 00:00:00 2001 From: "Michael S. Molina" <70410625+michael-s-molina@users.noreply.github.com> Date: Tue, 10 Aug 2021 09:12:28 -0300 Subject: [PATCH] fix: Multiple dashboard refresh triggers for the same session (#16094) --- 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 7069954b70ed8..3b934859eee44 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 e0207e860598e..c5177edf7187b 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); }