diff --git a/superset-frontend/src/dashboard/components/Header/index.jsx b/superset-frontend/src/dashboard/components/Header/index.jsx index 7069954b70..3b934859ee 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 e0207e8605..c5177edf71 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); }