0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-22 08:40:03 +01:00

fix(notebooks): use varying keys for global filters (#18601)

This commit is contained in:
Thomas Obermüller 2023-11-14 15:38:36 +01:00 committed by GitHub
parent 013be5194b
commit 56cf18ff29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 7 deletions

View File

@ -15,7 +15,7 @@ describe('Exporting Insights', () => {
)
cy.visit(urls.insightNew())
// apply filter
cy.get('[data-attr=insight-filters-add-filter-group]').click()
cy.get('[data-attr$=add-filter-group]').click()
cy.get('[data-attr=property-select-toggle-0]').click()
cy.get('[data-attr=taxonomic-filter-searchfield]').click()
cy.get('[data-attr=prop-filter-event_properties-1]').click({ force: true })

View File

@ -15,7 +15,7 @@ describe('Retention', () => {
// cy.get('[data-attr=insight-retention-add-filter-group]').click()
// cy.get('[data-attr=property-select-toggle-0]').click()
cy.get('[data-attr=insight-filters-add-filter-group]').click()
cy.get('[data-attr$=add-filter-group]').click()
cy.get('[data-attr=property-select-toggle-0]').click()
cy.get('[data-attr=taxonomic-filter-searchfield]').click()
cy.get('[data-attr=taxonomic-filter-searchfield]').type('is_demo')

View File

@ -92,7 +92,7 @@ describe('Trends', () => {
cy.get('.taxonomic-infinite-list').find('.taxonomic-list-row').contains('Pageview').click({ force: true })
cy.get('[data-attr=trend-element-subject-0]').should('have.text', 'Pageview')
cy.get('[data-attr=insight-filters-add-filter-group]').click()
cy.get('[data-attr$=add-filter-group]').click()
cy.get('[data-attr=property-select-toggle-0]').click()
cy.get('[data-attr=taxonomic-filter-searchfield]').click()
cy.get('[data-attr=prop-filter-event_properties-1]').click({ force: true })

View File

@ -55,7 +55,7 @@ export function interceptInsightLoad(insightType: string): string {
export const insight = {
applyFilter: (): void => {
cy.get('[data-attr=insight-filters-add-filter-group]').click()
cy.get('[data-attr$=add-filter-group]').click()
cy.get('[data-attr=property-select-toggle-0]').click()
cy.get('[data-attr=taxonomic-filter-searchfield]').click()
cy.get('[data-attr=prop-filter-event_properties-1]').click({ force: true })

View File

@ -7,6 +7,7 @@ import { getAllEventNames } from './utils'
import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'
import { EditorFilterProps } from '~/types'
import { StickinessQuery, TrendsQuery } from '~/queries/schema'
import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'
export function GlobalAndOrFilters({ insightProps }: EditorFilterProps): JSX.Element {
const { actions: allActions } = useValues(actionsModel)
@ -27,7 +28,8 @@ export function GlobalAndOrFilters({ insightProps }: EditorFilterProps): JSX.Ele
return (
<PropertyGroupFilters
pageKey="insight-filters"
insightProps={insightProps}
pageKey={`${keyForInsightLogicProps('new')(insightProps)}-GlobalAndOrFilters`}
query={querySource as TrendsQuery | StickinessQuery}
setQuery={updateQuerySource}
eventNames={getAllEventNames(querySource as TrendsQuery | StickinessQuery, allActions)}

View File

@ -1,5 +1,5 @@
import { useValues, BindLogic, useActions } from 'kea'
import { PropertyGroupFilterValue, AnyPropertyFilter } from '~/types'
import { PropertyGroupFilterValue, AnyPropertyFilter, InsightLogicProps } from '~/types'
import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
import './PropertyGroupFilters.scss'
import { propertyGroupFilterLogic } from './propertyGroupFilterLogic'
@ -12,8 +12,10 @@ import { LemonButton, LemonDivider } from '@posthog/lemon-ui'
import React from 'react'
import { InsightQueryNode, StickinessQuery, TrendsQuery } from '~/queries/schema'
import { AndOrFilterSelect } from './AndOrFilterSelect'
import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'
type PropertyGroupFiltersProps = {
insightProps: InsightLogicProps
query: TrendsQuery | StickinessQuery
setQuery: (node: TrendsQuery | StickinessQuery) => void
pageKey: string
@ -23,6 +25,7 @@ type PropertyGroupFiltersProps = {
}
export function PropertyGroupFilters({
insightProps,
query,
setQuery,
pageKey,
@ -104,7 +107,9 @@ export function PropertyGroupFilters({
onChange={(properties) => {
setPropertyFilters(properties, propertyGroupIndex)
}}
pageKey={`insight-filters-${propertyGroupIndex}`}
pageKey={`${keyForInsightLogicProps('new')(
insightProps
)}-PropertyGroupFilters-${propertyGroupIndex}`}
taxonomicGroupTypes={taxonomicGroupTypes}
eventNames={eventNames}
propertyGroupType={group.type}