:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(replay-vision): hint event vs person property in scanner filters (#73259)
Arno Hillenab20f4f86aa7
diff --git a/products/replay_vision/frontend/replay_scanners/components/ScannerTriggers.tsx b/products/replay_vision/frontend/replay_scanners/components/ScannerTriggers.tsxindex d2b917e7b7ef..69353671deea 100644--- a/products/replay_vision/frontend/replay_scanners/components/ScannerTriggers.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/ScannerTriggers.tsx@@ -1,6 +1,6 @@import { useActions, useValues } from 'kea'-import { LemonCard, LemonInput, LemonSegmentedButton, LemonTag } from '@posthog/lemon-ui'+import { LemonBanner, LemonCard, LemonInput, LemonSegmentedButton, LemonTag } from '@posthog/lemon-ui'import { resolveCategoryDropdownVariant, TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'import { TestAccountFilterSwitch } from 'lib/components/TestAccountFiltersSwitch'@@ -25,7 +25,7 @@ import { defaultRecordingDurationFilter } from 'scenes/session-recordings/playliimport { groupsModel } from '~/models/groupsModel'import { AndOrFilterSelect } from '~/queries/nodes/InsightViz/PropertyGroupFilters/AndOrFilterSelect'import { RecordingsQuery } from '~/queries/schema/schema-general'-import { RecordingUniversalFilters, UniversalFiltersGroup } from '~/types'+import { PropertyFilterType, RecordingUniversalFilters, UniversalFiltersGroup } from '~/types'import { clampDurationFilter, durationFilterError, MAX_ACTIVE_LABEL } from '../durationBounds'import { replayScannerLogic } from '../replayScannerLogic'@@ -46,6 +46,17 @@ const SCANNER_BASE_FILTER_TYPES: TaxonomicFilterGroupType[] = [TaxonomicFilterGroupType.SessionProperties,]+// True when any leaf in the group is an event *property* filter (type 'event'), not an event entity or person property.+// Used to surface a hint, since a key present on both the event and the person (e.g. a plan tier) matches nothing as an+// event property when it's only ever set on the person.+function groupHasEventProperty(group: UniversalFiltersGroup): boolean {+ return group.values.some((value) =>+ isUniversalGroupFilterLike(value)+ ? groupHasEventProperty(value)+ : 'type' in value && value.type === PropertyFilterType.Event+ )+}+// Renders the bound universal-filter group's values; adding is handled by the search bar above, not an inline button.function ScannerFilterGroup(): JSX.Element {const { filterGroup } = useValues(universalFiltersLogic)@@ -148,6 +159,14 @@ export function ScannerTriggers({ scannerId }: { scannerId: string }): JSX.Elemesize="small"/></div>+ {groupHasEventProperty(universal.filter_group) && (+ <LemonBanner type="info" dismissKey="replay-vision-event-vs-person-property-hint">+ <span className="text-xs">+ Some attributes are stored on the person, not the event. If an event property+ filter returns no recordings, try the same attribute under Person properties.+ </span>+ </LemonBanner>+ )}<UniversalFiltersrootKey={`replay-scanner-${scanner.id}`}group={universal.filter_group}