Skip to content

Commit

Permalink
fix(cohorts): do not load endlessly (#20297)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusandra authored Feb 13, 2024
1 parent 17719fe commit fe6ee21
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion frontend/src/models/cohortsModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { permanentlyMount } from 'lib/utils/kea-logic-builders'
import { BehavioralFilterKey } from 'scenes/cohorts/CohortFilters/types'
import { personsLogic } from 'scenes/persons/personsLogic'
import { isAuthenticatedTeam, teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'

import {
AnyCohortCriteriaType,
Expand Down Expand Up @@ -131,7 +132,7 @@ export const cohortsModel = kea<cohortsModelType>([
listeners(({ actions }) => ({
loadCohortsSuccess: async ({ cohorts }: { cohorts: CohortType[] }) => {
const is_calculating = cohorts.filter((cohort) => cohort.is_calculating).length > 0
if (!is_calculating) {
if (!is_calculating || !window.location.pathname.includes(urls.cohorts())) {
return
}
actions.setPollTimeout(window.setTimeout(actions.loadCohorts, POLL_TIMEOUT))
Expand Down

0 comments on commit fe6ee21

Please sign in to comment.