Skip to content

Commit

Permalink
fix: Multiple dashboard refresh triggers for the same session (apache…
Browse files Browse the repository at this point in the history
…#16094)

(cherry picked from commit 07f3399)
  • Loading branch information
michael-s-molina authored and villebro committed Aug 16, 2021
1 parent b33dd12 commit 6f36b41
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion superset-frontend/src/dashboard/components/Header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -196,6 +198,8 @@ class Header extends React.PureComponent {
}

componentWillUnmount() {
stopPeriodicRender(this.refreshTimer);
this.props.setRefreshFrequency(0);
clearTimeout(this.ctrlYTimeout);
clearTimeout(this.ctrlZTimeout);
}
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/dashboard/util/setPeriodicRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 6f36b41

Please sign in to comment.