mirror of
https://github.com/PostHog/posthog.git
synced 2024-12-01 12:21:02 +01:00
make sure to remove shown_as when switching to trends from stickiness (#6443)
This commit is contained in:
parent
9041e919b2
commit
e7b7c18ded
@ -1,5 +1,6 @@
|
||||
import { cleanFilters } from './cleanFilters'
|
||||
import { ChartDisplayType } from '~/types'
|
||||
import { ShownAsValue } from 'lib/constants'
|
||||
|
||||
describe('cleanFilters', () => {
|
||||
it('switches display to table if moving from TRENDS to RETENTION', () => {
|
||||
@ -10,4 +11,13 @@ describe('cleanFilters', () => {
|
||||
)
|
||||
).toEqual(expect.objectContaining({ insight: 'RETENTION', display: ChartDisplayType.ActionsTable }))
|
||||
})
|
||||
|
||||
it('removes shownas if moving from stickiness to trends', () => {
|
||||
expect(
|
||||
cleanFilters(
|
||||
{ insight: 'TRENDS', shown_as: ShownAsValue.STICKINESS },
|
||||
{ insight: 'STICKINESS', shown_as: ShownAsValue.STICKINESS }
|
||||
)
|
||||
).toEqual(expect.objectContaining({ insight: 'TRENDS', shown_as: undefined }))
|
||||
})
|
||||
})
|
||||
|
@ -133,9 +133,10 @@ export function cleanFilters(filters: Partial<FilterType>, oldFilters?: Partial<
|
||||
// TODO: Deprecated; should be removed once backend is updated
|
||||
if (filters.insight === ViewType.STICKINESS) {
|
||||
cleanSearchParams['shown_as'] = ShownAsValue.STICKINESS
|
||||
}
|
||||
if (filters.insight === ViewType.LIFECYCLE) {
|
||||
} else if (filters.insight === ViewType.LIFECYCLE) {
|
||||
cleanSearchParams['shown_as'] = ShownAsValue.LIFECYCLE
|
||||
} else {
|
||||
cleanSearchParams['shown_as'] = undefined
|
||||
}
|
||||
|
||||
if (filters.insight === ViewType.SESSIONS && !filters.session) {
|
||||
|
Loading…
Reference in New Issue
Block a user