From fe6ee215def8d92430300d720c57b3d7df7dcd6e Mon Sep 17 00:00:00 2001 From: Marius Andra Date: Tue, 13 Feb 2024 13:13:03 +0100 Subject: [PATCH] fix(cohorts): do not load endlessly (#20297) --- frontend/src/models/cohortsModel.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/models/cohortsModel.ts b/frontend/src/models/cohortsModel.ts index b095a9b946472..89b75b7e01404 100644 --- a/frontend/src/models/cohortsModel.ts +++ b/frontend/src/models/cohortsModel.ts @@ -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, @@ -131,7 +132,7 @@ export const cohortsModel = kea([ 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))