Skip to content

Commit

Permalink
fix: no polling when hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed Dec 13, 2024
1 parent e04eaca commit 9e67088
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export const sidePanelActivityLogic = kea<sidePanelActivityLogicType>([
],
})),

listeners(({ values, actions }) => ({
listeners(({ values, actions, cache }) => ({
setActiveTab: ({ tab }) => {
if (tab === SidePanelActivityTab.All && !values.allActivityResponseLoading) {
actions.loadAllActivity()
Expand All @@ -191,6 +191,13 @@ export const sidePanelActivityLogic = kea<sidePanelActivityLogicType>([
actions.setActiveTab(options as SidePanelActivityTab)
}
},
togglePolling: ({ pageIsVisible }) => {
if (pageIsVisible) {
actions.loadImportantChanges()
} else {
clearTimeout(cache.pollTimeout)
}
},
})),
selectors({
allActivity: [
Expand Down

0 comments on commit 9e67088

Please sign in to comment.