Skip to content

Commit

Permalink
refactor(insights): remove unused reportCohortCreatedFromPersonsModal
Browse files Browse the repository at this point in the history
  • Loading branch information
thmsobrmlr committed Jun 19, 2024
1 parent 295bc63 commit abfcc1c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 33 deletions.
4 changes: 0 additions & 4 deletions frontend/src/lib/utils/eventUsageLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportPersonsModalViewed: (params: any) => ({
params,
}),
reportCohortCreatedFromPersonsModal: (filters: Partial<FilterType>) => ({ filters }),
// insights
reportInsightCreated: (insightType: InsightType | null) => ({ insightType }),
reportInsightSaved: (filters: Partial<FilterType>, isNewInsight: boolean) => ({ filters, isNewInsight }),
Expand Down Expand Up @@ -642,9 +641,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportPersonsModalViewed: async ({ params }) => {
posthog.capture('insight person modal viewed', params)
},
reportCohortCreatedFromPersonsModal: async ({ filters }) => {
posthog.capture('person modal cohort created', sanitizeFilterParams(filters))
},
reportDashboardViewed: async ({ dashboard, lastRefreshed, delay }, breakpoint) => {
if (!delay) {
await breakpoint(500) // Debounce to avoid noisy events from continuous navigation
Expand Down
41 changes: 12 additions & 29 deletions frontend/src/scenes/trends/persons-modal/personsModalLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { actions, afterMount, connect, kea, listeners, path, props, propsChanged
import { loaders } from 'kea-loaders'
import { router, urlToAction } from 'kea-router'
import api from 'lib/api'
import { fromParamsGivenUrl, isGroupType } from 'lib/utils'
import { isGroupType } from 'lib/utils'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { cleanFilters } from 'scenes/insights/utils/cleanFilters'
import { urls } from 'scenes/urls'
Expand Down Expand Up @@ -75,7 +75,7 @@ export const personsModalLogic = kea<personsModalLogicType>([
}),
connect({
values: [groupsModel, ['groupTypes', 'aggregationLabel']],
actions: [eventUsageLogic, ['reportCohortCreatedFromPersonsModal', 'reportPersonsModalViewed']],
actions: [eventUsageLogic, ['reportPersonsModalViewed']],
}),

loaders(({ values, actions, props }) => ({
Expand Down Expand Up @@ -250,33 +250,16 @@ export const personsModalLogic = kea<personsModalLogicType>([
is_static: true,
name: cohortName,
}
if (values.actorsQuery) {
const cohort = await api.create('api/cohort', { ...cohortParams, query: values.actorsQuery })
cohortsModel.actions.cohortCreated(cohort)
lemonToast.success('Cohort saved', {
toastId: `cohort-saved-${cohort.id}`,
button: {
label: 'View cohort',
action: () => router.actions.push(urls.cohort(cohort.id)),
},
})
actions.setIsCohortModalOpen(false)
} else {
const qs = props.url?.split('?').pop() || ''
const cohort = await api.create('api/cohort?' + qs, cohortParams)
cohortsModel.actions.cohortCreated(cohort)
lemonToast.success('Cohort saved', {
toastId: `cohort-saved-${cohort.id}`,
button: {
label: 'View cohort',
action: () => router.actions.push(urls.cohort(cohort.id)),
},
})

const filters = fromParamsGivenUrl('?' + qs)
actions.setIsCohortModalOpen(false)
actions.reportCohortCreatedFromPersonsModal(filters)
}
const cohort = await api.create('api/cohort', { ...cohortParams, query: values.actorsQuery })
cohortsModel.actions.cohortCreated(cohort)
lemonToast.success('Cohort saved', {
toastId: `cohort-saved-${cohort.id}`,
button: {
label: 'View cohort',
action: () => router.actions.push(urls.cohort(cohort.id)),
},
})
actions.setIsCohortModalOpen(false)
},
loadNextActors: () => {
if (values.actorsResponse?.next) {
Expand Down

0 comments on commit abfcc1c

Please sign in to comment.