: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
chore(web-analytics): remove code for flags with no flag in posthog (#120135)
Paul D'Ambrac313e88936ab
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 6dc9393f78f2..5bc8aa3888a2 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -14647,9 +14647,9 @@ snapshots:scenes-app-settings-environment--settings-environment-surveys--light:hash: v1.k794b7964.207944bd75ef551a13937ebd442aa7a3efbe6ad6370f75b36188955b0aacd487.mgWOBNeJkX87Y3SdH0dH8R7ff71klfkhbdNhDD0WFC4scenes-app-settings-environment--settings-environment-web-analytics--dark:- hash: v1.k794b7964.905d72a75d81df5d93f76f12778107287b98bb424e659b84ae48681032aec09d.YUnsaSpEKr0SCw-ADEHO-TOmzhFPGsE4lH4Y9V9YceQ+ hash: v1.k794b7964.fe19fb69a98d2ab0172d211e0757142bf5fa816cd6da152590d3b5892b430f9b.LeCsObl-OgjexeFS5vfF6cujexXKuGDOgmzDR_0kNucscenes-app-settings-environment--settings-environment-web-analytics--light:- hash: v1.k794b7964.2bb2d096f6389829399c57890ac6b5de5a17fb1b33079680885c9d400f7df2da.64bmbq5xDL6XZgx5rlYIOMAtMxo9Ts5iQlIgEsLQNNg+ hash: v1.k794b7964.2d7c5efd6988d5fc968f263b5f49259841d44cc69c9607e25059789976582448.QwZG-i7TTw2Z5BipD7w0kZK95GNkdtuWpT6jirLQgFoscenes-app-settings-identity-provider-configuration--oidc--dark:hash: v1.k794b7964.1177527533a6ec000b396e1ee39627722226aed5cbab11759198dbbc2d72dcb3.NqKVUNSdSz-yE-r1M5EiEIaPRbQwBbyjCAf7rSSi9Doscenes-app-settings-identity-provider-configuration--oidc--light:diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex 9821ca870cb5..bbff6e27b4fe 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -230,7 +230,6 @@ export const FEATURE_FLAGS = {SETTINGS_BOUNCE_RATE_PAGE_VIEW_MODE: 'settings-bounce-rate-page-view-mode', // owner: #team-web-analyticsSETTINGS_PERSONS_JOIN_MODE: 'settings-persons-join-mode', // owner: #team-analytics-platformSETTINGS_SESSION_TABLE_VERSION: 'settings-session-table-version', // owner: #team-analytics-platform- SETTINGS_SESSIONS_V2_JOIN: 'settings-sessions-v2-join', // owner: @robbie-c #team-web-analyticsSETTINGS_WEB_ANALYTICS_PRE_AGGREGATED_TABLES: 'web-analytics-pre-aggregated-tables', // owner: @lricoy #team-web-analyticsSIGNALS_EXPECTED_IMPACT_DISPLAY: 'signals-expected-impact', // owner: #team-self-driving, person-level display gate for metric follow-up graphs and actionsSIGNALS_INBOX_VALUE_SUMMARY: 'signals-inbox-value-summary', // owner: #team-self-driving@@ -361,7 +360,6 @@ export const FEATURE_FLAGS = {INTERNAL_FEEDBACK_WIDGET: 'internal-feedback-widget', // owner: @adamleithp, gates the staff UI feedback bar that posts to SlackJS_SNIPPET_VERSIONING: 'js-snippet-versioning', // owner: #team-client-librariesLEGACY_OAUTH_RECONNECT_WARNING: 'legacy-oauth-reconnect-warning', // owner: @jabahamondes #team-web-analytics — kill-switch for the retiring-OAuth-app reconnect banner- LIVE_EVENTS_RICH_FILTERS: 'live-events-rich-filters', // owner: @jordanm-posthog #team-web-analyticsLIVESTREAM_HOGQL: 'livestream-hogql', // owner: @benjackwhite #team-replay, swaps livestream service calls for HogQL queriesLLM_ANALYTICS_CLUSTERING_ADMIN: 'llm-analytics-clustering-admin', // owner: #team-ai-observabilityLLM_ANALYTICS_COMMUNITY_SKILLS: 'llm-analytics-community-skills', // owner: #team-ai-observability@@ -570,7 +568,6 @@ export const FEATURE_FLAGS = {WAREHOUSE_PERSON_PROPERTIES: 'warehouse-person-properties', // owner: @tomowers #team-warehouse-sources, gates warehouse -> person properties (person-target custom property sources)WEB_ANALYTICS_ACHIEVEMENTS: 'web-analytics-achievements', // owner: @jordanm-posthog #team-web-analyticsWEB_ANALYTICS_AGENT_ANALYTICS: 'web-analytics-agent-analytics', // owner: @jordanm-posthog #team-web-analytics- WEB_ANALYTICS_BACK_NAVIGATION_RESET: 'web-analytics-back-navigation-reset', // owner: @jordanm-posthog #team-web-analyticsWEB_ANALYTICS_BOT_ANALYSIS: 'web-analytics-bot-analysis', // owner: @lricoy #team-web-analyticsWEB_ANALYTICS_CONTENT_AUTOPILOT: 'web-analytics-content-autopilot', // owner: @jordanm-posthog #team-web-analyticsWEB_ANALYTICS_CONVERSION_GOAL_PREAGG: 'web-analytics-conversion-goal-preagg', // owner: @lricoy #team-web-analytics@@ -581,11 +578,9 @@ export const FEATURE_FLAGS = {WEB_ANALYTICS_INCLUDE_HOST: 'web-analytics-include-host', // owner: @lricoy #team-web-analyticsWEB_ANALYTICS_LIVE_CITY_BREAKDOWN: 'web-analytics-live-city-breakdown', // owner: @jordanm-posthog #team-web-analyticsWEB_ANALYTICS_LIVE_MAP: 'web-analytics-live-map', // owner: @jordanm-posthog #team-web-analytics- WEB_ANALYTICS_LIVE_PERSON_DRILLDOWN: 'web-analytics-live-person-drilldown', // owner: @jordanm-posthog #team-web-analyticsWEB_ANALYTICS_MARKETING: 'marketing-analytics', // owner: @jabahamondes #team-web-analyticsWEB_ANALYTICS_MARKETING_CROSS_SELL: 'web-analytics-marketing-cross-sell', // owner: @jabahamondes #team-web-analyticsWEB_ANALYTICS_MARKETING_CROSS_SELL_V2: 'web-analytics-marketing-cross-sell-v2', // owner: @jordanm-posthog #team-web-analytics multivariate=control,test- WEB_ANALYTICS_OPEN_URL: 'web-analytics-open-url', // owner: @lricoy #team-web-analyticsWEB_ANALYTICS_PAGE_PERFORMANCE: 'web-analytics-page-performance', // owner: @jordanm-posthog #team-web-analyticsWEB_ANALYTICS_PRECOMPUTE_TOGGLE: 'web-analytics-precompute-toggle', // owner: @lricoy #team-web-analyticsWEB_ANALYTICS_RECAP: 'web-analytics-recap', // owner: @jordanm-posthog #team-web-analytics@@ -598,7 +593,6 @@ export const FEATURE_FLAGS = {WEB_ANALYTICS_TILE_HEADER_V2: 'web-analytics-tile-header-v2', // owner: @jordanm-posthog #team-web-analytics multivariate=control,testWEB_ANALYTICS_TILE_SKELETONS: 'web-analytics-tile-skeletons', // owner: @jordanm-posthog #team-web-analyticsWEB_ANALYTICS_TILE_TOGGLES: 'web-analytics-tile-toggles', // owner: @lricoy #team-web-analytics- WEB_ANALYTICS_TOOLTIP_COMPARISON_LABELS: 'web-analytics-tooltip-comparison-labels', // owner: @lricoy #team-web-analyticsWIZARD_RUN_SYNC: 'wizard-run-sync', // owner: #team-growth multivariate=wizard-session,wizard-run — selects the Wizard sync widgetWIZARD_UI_ENABLED: 'wizard-ui-enabled', // owner: @fercgomes #team-growth — gates the /wizard/runs interfaceWORKFLOW_AI_TASK_ACTION: 'workflow-ai-task-action', // owner: @mayteio #team-workflowsdiff --git a/frontend/src/scenes/activity/live/LiveEventsTable.tsx b/frontend/src/scenes/activity/live/LiveEventsTable.tsxindex b519856539ba..03cc06805999 100644--- a/frontend/src/scenes/activity/live/LiveEventsTable.tsx+++ b/frontend/src/scenes/activity/live/LiveEventsTable.tsx@@ -7,10 +7,8 @@ import { LemonButton, Link } from '@posthog/lemon-ui'import { LiveUserCount } from 'lib/components/LiveUserCount'import { PropertyFilters } from 'lib/components/PropertyFilters/PropertyFilters'import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'-import { FEATURE_FLAGS } from 'lib/constants'import { usePageVisibility } from 'lib/hooks/usePageVisibility'import { LemonBanner } from 'lib/lemon-ui/LemonBanner'-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { ActivitySceneHeader } from 'scenes/activity/ActivitySceneHeader'import { sceneConfigurations } from 'scenes/scenes'import { Scene, SceneExport } from 'scenes/sceneTypes'@@ -26,7 +24,7 @@ import { useAttachedContext } from 'products/posthog_ai/frontend/api/logics'import { buildLiveEventsAgentContext } from '../activityAgentContext'import { LiveBotPanel } from './LiveBotPanel'import { LiveEventsFeed } from './LiveEventsFeed'-import { LIVE_EVENTS_SUPPORTED_OPERATORS, liveEventsLogic } from './liveEventsLogic'+import { liveEventsLogic } from './liveEventsLogic'import { liveEventsTableSceneLogic } from './liveEventsTableSceneLogic'const LIVE_EVENTS_POLL_INTERVAL_MS = 1500@@ -40,7 +38,6 @@ export const scene: SceneExport = {export function LiveEventsTable(): JSX.Element {const { events, streamPaused, filters } = useValues(liveEventsLogic)const { pauseStream, resumeStream, setFilters, clearEvents } = useActions(liveEventsLogic)- const { featureFlags } = useValues(featureFlagLogic)useAttachedContext(buildLiveEventsAgentContext(filters))@@ -101,11 +98,7 @@ export function LiveEventsTable(): JSX.Element {propertyFilters={filters.properties ?? []}onChange={(properties) => setFilters({ ...filters, properties })}taxonomicGroupTypes={[TaxonomicFilterGroupType.EventProperties]}- operatorAllowlist={- featureFlags[FEATURE_FLAGS.LIVE_EVENTS_RICH_FILTERS]- ? LIVE_EVENTS_SUPPORTED_OPERATORS- : [PropertyOperator.Exact]- }+ operatorAllowlist={[PropertyOperator.Exact]}buttonText="Filter by property"/><LemonButtondiff --git a/frontend/src/scenes/activity/live/liveEventsLogic.test.ts b/frontend/src/scenes/activity/live/liveEventsLogic.test.tsindex 4f50c119fb2c..9f1bcb86f81a 100644--- a/frontend/src/scenes/activity/live/liveEventsLogic.test.ts+++ b/frontend/src/scenes/activity/live/liveEventsLogic.test.ts@@ -1,7 +1,6 @@import { expectLogic } from 'kea-test-utils'import api from 'lib/api'-import { FEATURE_FLAGS } from 'lib/constants'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { initKeaTests } from '~/test/init'@@ -45,13 +44,6 @@ describe('liveEventsLogic', () => {streamSpy.mockRestore()})- function setRichFiltersFlag(enabled: boolean): void {- flagsLogic.actions.setFeatureFlags(- enabled ? [FEATURE_FLAGS.LIVE_EVENTS_RICH_FILTERS] : [],- enabled ? { [FEATURE_FLAGS.LIVE_EVENTS_RICH_FILTERS]: true } : {}- )- }-function lastStreamUrl(): URL {const calls = streamSpy.mock.callsif (calls.length === 0) {@@ -97,57 +89,12 @@ describe('liveEventsLogic', () => {properties: [eventFilter('$browser', PropertyOperator.Exact, ['Chrome', 'Firefox'])],expectedProperty: ['$browser=Chrome', '$browser=Firefox'],},- ])('with the flag off, $label', ({ properties, expectedProperty }) => {- setRichFiltersFlag(false)+ ])('$label', ({ properties, expectedProperty }) => {logic.actions.setFilters({ properties })const url = lastStreamUrl()expect(url.searchParams.getAll('property')).toEqual(expectedProperty)expect(url.searchParams.has('properties')).toBe(false)})-- it.each([- {- label: 'emits a single JSON properties param',- properties: [- eventFilter('$current_url', PropertyOperator.IContains, 'checkout'),- eventFilter('$browser', PropertyOperator.Exact, ['Chrome', 'Firefox']),- eventFilter('amount', PropertyOperator.GreaterThan, 100),- eventFilter('$referrer', PropertyOperator.IsSet),- ],- expectedProperties: [- { key: '$current_url', operator: 'icontains', value: 'checkout' },- { key: '$browser', operator: 'exact', value: ['Chrome', 'Firefox'] },- { key: 'amount', operator: 'gt', value: 100 },- { key: '$referrer', operator: 'is_set' },- ],- },- {- label: 'skips null values, empty arrays, and unsupported operators',- properties: [- eventFilter('$current_url', PropertyOperator.Exact, null),- eventFilter('$browser', PropertyOperator.Exact, []),- eventFilter('$pathname', PropertyOperator.Between, '5'),- eventFilter('$os', PropertyOperator.IContains, 'mac'),- ],- expectedProperties: [{ key: '$os', operator: 'icontains', value: 'mac' }],- },- {- label: 'omits the properties param entirely when nothing is eligible',- properties: [eventFilter('$current_url', PropertyOperator.Exact, null)],- expectedProperties: null,- },- ])('with the flag on, $label', ({ properties, expectedProperties }) => {- setRichFiltersFlag(true)- logic.actions.setFilters({ properties })-- const url = lastStreamUrl()- expect(url.searchParams.has('property')).toBe(false)- if (expectedProperties === null) {- expect(url.searchParams.has('properties')).toBe(false)- } else {- expect(JSON.parse(url.searchParams.get('properties')!)).toEqual(expectedProperties)- }- })})})diff --git a/frontend/src/scenes/activity/live/liveEventsLogic.tsx b/frontend/src/scenes/activity/live/liveEventsLogic.tsxindex c181c26cb694..0386543cef6e 100644--- a/frontend/src/scenes/activity/live/liveEventsLogic.tsx+++ b/frontend/src/scenes/activity/live/liveEventsLogic.tsx@@ -7,10 +7,9 @@ import { isEventPropertyFilter } from 'lib/components/PropertyFilters/utils'import { FEATURE_FLAGS } from 'lib/constants'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { liveEventsHostOrigin } from 'lib/utils/apiHost'-import { isOperatorFlag } from 'lib/utils/operators'import { teamLogic } from 'scenes/teamLogic'-import { AnyPropertyFilter, LiveEvent, PropertyFilterValue, PropertyOperator } from '~/types'+import { AnyPropertyFilter, LiveEvent, PropertyOperator } from '~/types'import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'import type { TeamPublicType, TeamType } from '../../../types'@@ -19,21 +18,6 @@ import { LIVE_EVENTS_QUERY_POLL_MS, loadRecentLiveEvents } from './liveEventsQueconst ERROR_TOAST_ID = 'live-stream-error'-export const LIVE_EVENTS_SUPPORTED_OPERATORS: PropertyOperator[] = [- PropertyOperator.Exact,- PropertyOperator.IsNot,- PropertyOperator.IContains,- PropertyOperator.NotIContains,- PropertyOperator.Regex,- PropertyOperator.NotRegex,- PropertyOperator.GreaterThan,- PropertyOperator.GreaterThanOrEqual,- PropertyOperator.LessThan,- PropertyOperator.LessThanOrEqual,- PropertyOperator.IsSet,- PropertyOperator.IsNotSet,-]-export interface LiveEventsLogicProps {showLiveStreamErrorToast?: boolean}@@ -235,47 +219,16 @@ export const liveEventsLogic = kea<liveEventsLogicType>([if (eventType) {url.searchParams.append('eventType', eventType)}- if (values.featureFlags[FEATURE_FLAGS.LIVE_EVENTS_RICH_FILTERS]) {- const richFilters: { key: string; operator: PropertyOperator; value?: PropertyFilterValue }[] = []- for (const pf of properties ?? []) {- if (!isEventPropertyFilter(pf) || !pf.key || !pf.operator) {- continue- }- if (!LIVE_EVENTS_SUPPORTED_OPERATORS.includes(pf.operator)) {- continue- }- if (isOperatorFlag(pf.operator)) {- richFilters.push({ key: pf.key, operator: pf.operator })- continue- }- if (pf.value == null) {- continue- }- if (Array.isArray(pf.value)) {- const cleaned = pf.value.filter((v) => v != null)- if (cleaned.length === 0) {- continue- }- richFilters.push({ key: pf.key, operator: pf.operator, value: cleaned })- } else {- richFilters.push({ key: pf.key, operator: pf.operator, value: pf.value })- }+ for (const pf of properties ?? []) {+ if (!isEventPropertyFilter(pf) || pf.operator !== PropertyOperator.Exact || !pf.key) {+ continue}- if (richFilters.length > 0) {- url.searchParams.append('properties', JSON.stringify(richFilters))- }- } else {- for (const pf of properties ?? []) {- if (!isEventPropertyFilter(pf) || pf.operator !== PropertyOperator.Exact || !pf.key) {+ const vals = Array.isArray(pf.value) ? pf.value : [pf.value]+ for (const v of vals) {+ if (v == null) {continue}- const vals = Array.isArray(pf.value) ? pf.value : [pf.value]- for (const v of vals) {- if (v == null) {- continue- }- url.searchParams.append('property', `${pf.key}=${String(v)}`)- }+ url.searchParams.append('property', `${pf.key}=${String(v)}`)}}url.searchParams.append('columns', '$current_url,$screen_name')diff --git a/frontend/src/scenes/settings/SettingsMap.tsx b/frontend/src/scenes/settings/SettingsMap.tsxindex 2556f12854f9..2a5864e1bb3f 100644--- a/frontend/src/scenes/settings/SettingsMap.tsx+++ b/frontend/src/scenes/settings/SettingsMap.tsx@@ -37,7 +37,6 @@ import { PersonsOnEvents } from 'scenes/settings/environment/PersonsOnEvents'import { PreAggregatedTablesSetting } from 'scenes/settings/environment/PreAggregatedTablesSetting'import { ReplayTriggers } from 'scenes/settings/environment/ReplayTriggers'import { SessionsTableVersion } from 'scenes/settings/environment/SessionsTableVersion'-import { SessionsV2JoinModeSettings } from 'scenes/settings/environment/SessionsV2JoinModeSettings'import {TaskAgentMyPreferenceSettings,TaskAgentProjectDefaultSettings,@@ -1793,15 +1792,6 @@ export const SETTINGS_MAP: SettingSection[] = [flag: 'SETTINGS_BOUNCE_RATE_PAGE_VIEW_MODE',keywords: ['bounce', 'pageview', 'url', 'calculation'],},- {- id: 'session-join-mode',- title: 'Session join mode',- description:- "Choose which join mode to use for sessions. Don't change this unless you know what you're doing.",- component: <SessionsV2JoinModeSettings />,- flag: 'SETTINGS_SESSIONS_V2_JOIN',- keywords: ['session', 'join', 'string', 'uuid'],- },{id: 'web-analytics-pre-aggregated-tables',title: 'Pre-aggregated tables',diff --git a/frontend/src/scenes/settings/environment/SessionsV2JoinModeSettings.tsx b/frontend/src/scenes/settings/environment/SessionsV2JoinModeSettings.tsxdeleted file mode 100644index 8ce6695d2c85..000000000000--- a/frontend/src/scenes/settings/environment/SessionsV2JoinModeSettings.tsx+++ /dev/null@@ -1,35 +0,0 @@-import { RestrictionScope, useRestrictedArea } from 'lib/components/RestrictedArea'-import { TeamMembershipLevel } from 'lib/constants'-import { LemonRadioOption } from 'lib/lemon-ui/LemonRadio'--import { HogQLQueryModifiers } from '~/queries/schema/schema-general'--import { TeamSettingRadio } from '../components/TeamSettingRadio'--type SessionsV2JoinModeType = NonNullable<HogQLQueryModifiers['sessionsV2JoinMode']>--const SESSIONS_V2_JOIN_MODE_OPTIONS: LemonRadioOption<SessionsV2JoinModeType>[] = [- { value: 'string', label: 'String' },- { value: 'uuid', label: 'UUID' },-]--export function SessionsV2JoinModeSettings(): JSX.Element {- const restrictedReason = useRestrictedArea({- scope: RestrictionScope.Project,- minimumAccessLevel: TeamMembershipLevel.Admin,- })-- const sessionsV2JoinModeOptions = SESSIONS_V2_JOIN_MODE_OPTIONS.map((o) => ({- ...o,- disabledReason: restrictedReason ?? undefined,- }))-- return (- <TeamSettingRadio- field="modifiers.sessionsV2JoinMode"- options={sessionsV2JoinModeOptions}- defaultValue="string"- disabledReason={restrictedReason}- />- )-}diff --git a/frontend/src/scenes/settings/types.ts b/frontend/src/scenes/settings/types.tsindex 6427cc2f0ce3..53dfd5b27829 100644--- a/frontend/src/scenes/settings/types.ts+++ b/frontend/src/scenes/settings/types.ts@@ -288,7 +288,6 @@ export type SettingId =| 'saml-configuration'| 'oidc-configuration'| 'scim-configuration'- | 'session-join-mode'| 'session-table-version'| 'snippet'| 'snippet-v2'diff --git a/frontend/src/scenes/web-analytics/LiveMetricsDashboard/LivePersonDrillDown.tsx b/frontend/src/scenes/web-analytics/LiveMetricsDashboard/LivePersonDrillDown.tsxdeleted file mode 100644index 7bf630a0250d..000000000000--- a/frontend/src/scenes/web-analytics/LiveMetricsDashboard/LivePersonDrillDown.tsx+++ /dev/null@@ -1,161 +0,0 @@-import { useActions, useValues } from 'kea'--import { IconInfo, IconRefresh } from '@posthog/icons'-import { LemonButton, LemonSkeleton, Tooltip } from '@posthog/lemon-ui'--import { LemonDrawer } from 'lib/lemon-ui/LemonDrawer/LemonDrawer'--import {- LivePersonDrillDownBreakdownType,- LivePersonDrillDownSelection,- livePersonDrillDownDrawerLogic,-} from './livePersonDrillDownDrawerLogic'-import { livePersonDrillDownLogic } from './livePersonDrillDownLogic'-import { LivePersonDrillDownRow } from './LivePersonDrillDownRow'--const BREAKDOWN_TITLE_PREFIX: Record<LivePersonDrillDownBreakdownType, string> = {- country: 'Visitors from',- city: 'Visitors from',- device: 'Visitors using',- browser: 'Visitors using',-}--const LivePersonDrillDownInner = ({ selection }: { selection: LivePersonDrillDownSelection }): JSX.Element => {- const { closeDrillDown } = useActions(livePersonDrillDownDrawerLogic)- const logicProps = {- breakdownType: selection.breakdownType,- breakdownValue: selection.breakdownValue,- }- const {- persons,- personsLoading,- totalCount,- identifiedCount,- anonymousCount,- newVisitorCount,- isTruncated,- recordingCountByPersonKey,- } = useValues(livePersonDrillDownLogic(logicProps))- const { refresh } = useActions(livePersonDrillDownLogic(logicProps))-- const title = `${BREAKDOWN_TITLE_PREFIX[selection.breakdownType]} ${selection.breakdownLabel}`-- return (- <LemonDrawer- isOpen- onClose={closeDrillDown}- title={- <div className="flex items-center gap-2 min-w-0">- <span className="truncate">{title}</span>- <span className="text-sm font-normal text-muted tabular-nums shrink-0">- {totalCount.toLocaleString()}- </span>- </div>- }- description={- <div className="flex items-center gap-1 text-xs text-muted">- Visitors in the last 30 minutes- <Tooltip title="Lists persons seen for this segment within the live dashboard's 30-minute window. The count updates live as new visitors arrive.">- <IconInfo className="text-sm" />- </Tooltip>- </div>- }- footer={- <LemonButton type="secondary" size="small" icon={<IconRefresh />} onClick={refresh}>- Refresh- </LemonButton>- }- data-attr="live-person-drilldown"- >- <div className="flex flex-col gap-3">- {newVisitorCount > 0 && (- <LemonButton- type="secondary"- size="small"- fullWidth- center- icon={<IconRefresh />}- onClick={refresh}- data-attr="live-person-drilldown-refresh-pill"- >- {newVisitorCount === 1- ? '1 new visitor — refresh'- : `${newVisitorCount.toLocaleString()} new visitors — refresh`}- </LemonButton>- )}-- {personsLoading && persons.length === 0 ? (- <div className="flex flex-col gap-2">- {Array.from({ length: 6 }).map((_, i) => (- <LemonSkeleton key={i} className="h-10 w-full" />- ))}- </div>- ) : identifiedCount === 0 && anonymousCount === 0 ? (- <div className="text-sm text-muted text-center py-8">No visitors in this window</div>- ) : (- <>- {persons.length > 0 && (- <div className="flex flex-col">- <div className="text-xs font-semibold text-muted uppercase mb-2">- Identified ({persons.length.toLocaleString()}- {isTruncated ? ` of ${identifiedCount.toLocaleString()}` : ''})- </div>- <div className="flex flex-col">- {persons.map((person) => {- const key = person.id ?? person.uuid- return (- <LivePersonDrillDownRow- key={key}- person={person}- recordingCount={key ? recordingCountByPersonKey[key] : undefined}- />- )- })}- </div>- {isTruncated && (- <div className="text-xs text-muted mt-2">- Showing the {persons.length.toLocaleString()} most recently seen — narrow- filters to see more.- </div>- )}- </div>- )}-- {persons.length === 0 && identifiedCount > 0 && !personsLoading && (- <div className="text-sm text-muted">- No profiles found for these distinct IDs. They may not have person processing enabled.- </div>- )}-- {anonymousCount > 0 && (- <div className="flex flex-col gap-1 pt-2 border-t border-border">- <div className="text-xs font-semibold text-muted uppercase">Anonymous</div>- <Tooltip title="Cookieless visitors are tracked anonymously by IP and user agent. They do not have a person profile and cannot be linked to.">- <div className="text-sm text-muted">- {anonymousCount === 1- ? '1 anonymous visitor — no profile linked'- : `${anonymousCount.toLocaleString()} anonymous visitors — no profile linked`}- </div>- </Tooltip>- </div>- )}- </>- )}- </div>- </LemonDrawer>- )-}--export const LivePersonDrillDown = (): JSX.Element | null => {- const { currentSelection } = useValues(livePersonDrillDownDrawerLogic)- if (!currentSelection) {- return null- }- return (- <LivePersonDrillDownInner- // Re-mount when the (type, value) tuple changes so the keyed logic instance switches cleanly.- key={`${currentSelection.breakdownType}:${currentSelection.breakdownValue}`}- selection={currentSelection}- />- )-}diff --git a/frontend/src/scenes/web-analytics/LiveMetricsDashboard/LivePersonDrillDownRow.tsx b/frontend/src/scenes/web-analytics/LiveMetricsDashboard/LivePersonDrillDownRow.tsxdeleted file mode 100644index 1f11140b7161..000000000000--- a/frontend/src/scenes/web-analytics/LiveMetricsDashboard/LivePersonDrillDownRow.tsx+++ /dev/null@@ -1,71 +0,0 @@-import { IconPlay } from '@posthog/icons'-import { LemonButton, Link } from '@posthog/lemon-ui'--import { TZLabel } from 'lib/components/TZLabel'-import { pluralize } from 'lib/utils/strings'-import { urls } from 'scenes/urls'--import { PersonsTabType, PersonType } from '~/types'--import { PersonDisplay } from 'products/persons/frontend/components/PersonDisplay'-import { pickBestPersonDistinctId } from 'products/persons/frontend/person-utils'--interface LivePersonDrillDownRowProps {- person: PersonType- recordingCount?: number-}--const pickSecondaryProperty = (person: PersonType): { key: string; value: string } | null => {- const candidates = ['email', '$browser', '$os', '$geoip_country_code']- for (const key of candidates) {- const raw = person.properties?.[key]- if (typeof raw === 'string' && raw.length > 0) {- return { key, value: raw }- }- }- return null-}--const recordingsUrlForPerson = (distinctId: string): string =>- `${urls.personByDistinctId(distinctId)}#activeTab=${PersonsTabType.SESSION_RECORDINGS}`--export const LivePersonDrillDownRow = ({ person, recordingCount }: LivePersonDrillDownRowProps): JSX.Element => {- const distinctId = pickBestPersonDistinctId(person.distinct_ids)- const secondary = pickSecondaryProperty(person)- const href = distinctId ? urls.personByDistinctId(distinctId) : undefined-- return (- <div className="flex items-center gap-3" data-attr="live-person-drilldown-row">- <Link- to={href}- subtle- className="flex items-center gap-3 min-w-0 flex-1 px-2 py-2 -mx-2 rounded hover:bg-bg-3000"- >- <PersonDisplay person={person} withIcon noPopover noLink />- {secondary && (- <span className="min-w-0 text-xs text-muted truncate ph-no-capture">- {secondary.key === 'email' ? secondary.value : `${secondary.key}: ${secondary.value}`}- </span>- )}- </Link>- {recordingCount && recordingCount > 0 && distinctId && (- <LemonButton- size="xsmall"- type="secondary"- icon={<IconPlay />}- to={recordingsUrlForPerson(distinctId)}- targetBlank- tooltip={`Watch ${pluralize(recordingCount, 'recording')} from the last 30 minutes`}- data-attr="live-person-drilldown-row-watch"- >- {recordingCount.toLocaleString()}- </LemonButton>- )}- {person.last_seen_at && (- <span className="text-xs text-muted shrink-0">- <TZLabel time={person.last_seen_at} />- </span>- )}- </div>- )-}diff --git a/frontend/src/scenes/web-analytics/LiveMetricsDashboard/LiveWebAnalyticsMetrics.tsx b/frontend/src/scenes/web-analytics/LiveMetricsDashboard/LiveWebAnalyticsMetrics.tsxindex 2461f16549d3..0d337b87e3ef 100644--- a/frontend/src/scenes/web-analytics/LiveMetricsDashboard/LiveWebAnalyticsMetrics.tsx+++ b/frontend/src/scenes/web-analytics/LiveMetricsDashboard/LiveWebAnalyticsMetrics.tsx@@ -40,21 +40,13 @@ import { LiveBotTrafficCard } from './LiveBotTrafficCard'import { CONTENT_CARD_SPAN, LiveContentCardId, LiveStatCardId } from './liveCards'import { LiveChartCard } from './LiveChartCard'import { LiveLocationsCard } from './LiveLocationsCard'-import { LivePersonDrillDown } from './LivePersonDrillDown'-import { LivePersonDrillDownSelection, livePersonDrillDownDrawerLogic } from './livePersonDrillDownDrawerLogic'import { LiveStatCard, LiveStatDivider } from './LiveStatCard'import { LiveTopPathsTable } from './LiveTopPathsTable'import { LiveTopReferrersTable } from './LiveTopReferrersTable'import { liveWebAnalyticsLayoutLogic } from './liveWebAnalyticsLayoutLogic'import { BotEventsPerMinuteChart, UsersPerMinuteChart } from './liveWebAnalyticsMetricsCharts'import { liveWebAnalyticsMetricsLogic } from './liveWebAnalyticsMetricsLogic'-import {- BrowserBreakdownItem,- buildCityKey,- CityBreakdownItem,- CountryBreakdownItem,- DeviceBreakdownItem,-} from './LiveWebAnalyticsMetricsTypes'+import { BrowserBreakdownItem, CountryBreakdownItem, DeviceBreakdownItem } from './LiveWebAnalyticsMetricsTypes'import { LiveWorldMap } from './LiveWorldMap'const LIVE_FEED_COLUMNS_WITH_RECORDINGS: LiveEventsFeedColumn[] = ['event', 'person', 'url', 'recording', 'timestamp']@@ -320,53 +312,9 @@ export const LiveWebAnalyticsMetrics = (): JSX.Element => {const { featureFlags } = useValues(featureFlagLogic)const { currentTeam } = useValues(teamLogic)- const drillDownEnabled = !!featureFlags[FEATURE_FLAGS.WEB_ANALYTICS_LIVE_PERSON_DRILLDOWN]const liveFeedColumns = currentTeam?.session_recording_opt_in? LIVE_FEED_COLUMNS_WITH_RECORDINGS: LIVE_FEED_COLUMNS_WITHOUT_RECORDINGS- const { openDrillDown } = useActions(livePersonDrillDownDrawerLogic)-- const buildRowClickHandler = <T,>(- isClickable: (item: T) => boolean,- toSelection: (item: T) => LivePersonDrillDownSelection- ): ((item: T) => void) | undefined =>- drillDownEnabled- ? (item: T): void => {- if (isClickable(item)) {- openDrillDown(toSelection(item))- }- }- : undefined-- const countrySelection = (countryCode: string): LivePersonDrillDownSelection => ({- breakdownType: 'country',- breakdownValue: countryCode,- breakdownLabel: COUNTRY_CODE_TO_LONG_NAME[countryCode] ?? countryCode,- })-- const onCountryRowClick = buildRowClickHandler<CountryBreakdownItem>(- (item) => item.country !== 'Other',- (item) => countrySelection(item.country)- )- const onCityRowClick = buildRowClickHandler<CityBreakdownItem>(- (item) => item.cityName !== 'Other',- (item) => ({- breakdownType: 'city',- breakdownValue: buildCityKey(item.cityName, item.countryCode),- breakdownLabel: item.countryCode ? `${item.cityName}, ${item.countryCode}` : item.cityName,- })- )- const onDeviceRowClick = buildRowClickHandler<DeviceBreakdownItem>(- (item) => item.device !== 'Other',- (item) => ({ breakdownType: 'device', breakdownValue: item.device, breakdownLabel: item.device })- )- const onBrowserRowClick = buildRowClickHandler<BrowserBreakdownItem>(- (item) => item.browser !== 'Other',- (item) => ({ breakdownType: 'browser', breakdownValue: item.browser, breakdownLabel: item.browser })- )- const onMapCountryClick = drillDownEnabled- ? (countryCode: string): void => openDrillDown(countrySelection(countryCode))- : undefinedconst { isVisible } = usePageVisibility()useEffect(() => {if (isVisible) {@@ -453,7 +401,6 @@ export const LiveWebAnalyticsMetrics = (): JSX.Element => {emptyMessage="No device data"statLabel="unique devices"isLoading={isLoading}- onItemClick={onDeviceRowClick}/>)case 'browsers':@@ -468,7 +415,6 @@ export const LiveWebAnalyticsMetrics = (): JSX.Element => {statLabel="unique browsers"totalCount={totalBrowsers}isLoading={isLoading}- onItemClick={onBrowserRowClick}/>)case 'top_countries':@@ -483,7 +429,6 @@ export const LiveWebAnalyticsMetrics = (): JSX.Element => {emptyMessage="No country data"statLabel="unique visitors"isLoading={isLoading}- onItemClick={onCountryRowClick}/>)}@@ -492,8 +437,6 @@ export const LiveWebAnalyticsMetrics = (): JSX.Element => {countryData={topCountryBreakdown}cityData={topCityBreakdown}isLoading={isLoading}- onCountryClick={onCountryRowClick}- onCityClick={onCityRowClick}/>)case 'bot_events_chart':@@ -538,7 +481,6 @@ export const LiveWebAnalyticsMetrics = (): JSX.Element => {<LiveWorldMapdata={countryBreakdown}totalEvents={countryBreakdown.reduce((sum, c) => sum + c.count, 0)}- onCountryClick={onMapCountryClick}/></LiveChartCard>)@@ -627,8 +569,6 @@ export const LiveWebAnalyticsMetrics = (): JSX.Element => {</div></SortableContext></DndContext>-- {drillDownEnabled && <LivePersonDrillDown />}</div>)}diff --git a/frontend/src/scenes/web-analytics/LiveMetricsDashboard/livePersonDrillDownDrawerLogic.ts b/frontend/src/scenes/web-analytics/LiveMetricsDashboard/livePersonDrillDownDrawerLogic.tsdeleted file mode 100644index 775797982e6f..000000000000--- a/frontend/src/scenes/web-analytics/LiveMetricsDashboard/livePersonDrillDownDrawerLogic.ts+++ /dev/null@@ -1,44 +0,0 @@-import { MakeLogicType, actions, kea, path, reducers } from 'kea'--export type LivePersonDrillDownBreakdownType = 'country' | 'city' | 'device' | 'browser'--export interface LivePersonDrillDownSelection {- breakdownType: LivePersonDrillDownBreakdownType- breakdownValue: string- breakdownLabel: string-}--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface livePersonDrillDownDrawerLogicValues {- currentSelection: LivePersonDrillDownSelection | null-}--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface livePersonDrillDownDrawerLogicActions {- closeDrillDown: () => {- value: true- }- openDrillDown: (selection: LivePersonDrillDownSelection) => LivePersonDrillDownSelection-}--export type livePersonDrillDownDrawerLogicType = MakeLogicType<- livePersonDrillDownDrawerLogicValues,- livePersonDrillDownDrawerLogicActions->--export const livePersonDrillDownDrawerLogic = kea<livePersonDrillDownDrawerLogicType>([- path(['scenes', 'webAnalytics', 'livePersonDrillDownDrawerLogic']),- actions({- openDrillDown: (selection: LivePersonDrillDownSelection) => selection,- closeDrillDown: true,- }),- reducers({- currentSelection: [- null as LivePersonDrillDownSelection | null,- {- openDrillDown: (_, payload) => payload,- closeDrillDown: () => null,- },- ],- }),-])diff --git a/frontend/src/scenes/web-analytics/LiveMetricsDashboard/livePersonDrillDownLogic.test.ts b/frontend/src/scenes/web-analytics/LiveMetricsDashboard/livePersonDrillDownLogic.test.tsdeleted file mode 100644index 6c3c6c86425a..000000000000--- a/frontend/src/scenes/web-analytics/LiveMetricsDashboard/livePersonDrillDownLogic.test.ts+++ /dev/null@@ -1,161 +0,0 @@-import { expectLogic } from 'kea-test-utils'--import { initKeaTests } from '~/test/init'-import { PersonType } from '~/types'--import { livePersonDrillDownDrawerLogic, LivePersonDrillDownSelection } from './livePersonDrillDownDrawerLogic'-import {- aggregateRecordingCountsByPerson,- COOKIELESS_DISTINCT_ID_PREFIX,- partitionDistinctIds,-} from './livePersonDrillDownLogic'--const makePerson = (overrides: Partial<PersonType> & { id?: string | number; uuid?: string }): PersonType =>- ({- distinct_ids: [],- properties: {},- created_at: '2020-01-01T00:00:00Z',- ...overrides,- }) as PersonType--describe('partitionDistinctIds', () => {- it('separates cookieless ids from identified ones', () => {- const result = partitionDistinctIds([- 'user-1',- `${COOKIELESS_DISTINCT_ID_PREFIX}abc`,- 'user-2',- `${COOKIELESS_DISTINCT_ID_PREFIX}def`,- ])- expect(result).toEqual({- identified: ['user-1', 'user-2'],- anonymous: [`${COOKIELESS_DISTINCT_ID_PREFIX}abc`, `${COOKIELESS_DISTINCT_ID_PREFIX}def`],- })- })-- it('handles an empty input', () => {- expect(partitionDistinctIds([])).toEqual({ identified: [], anonymous: [] })- })-- it('handles all-cookieless input', () => {- const result = partitionDistinctIds([`${COOKIELESS_DISTINCT_ID_PREFIX}a`, `${COOKIELESS_DISTINCT_ID_PREFIX}b`])- expect(result.identified).toEqual([])- expect(result.anonymous).toHaveLength(2)- })-- it('preserves order within each partition', () => {- const result = partitionDistinctIds([- 'z',- `${COOKIELESS_DISTINCT_ID_PREFIX}1`,- 'a',- `${COOKIELESS_DISTINCT_ID_PREFIX}2`,- 'm',- ])- expect(result.identified).toEqual(['z', 'a', 'm'])- expect(result.anonymous).toEqual([`${COOKIELESS_DISTINCT_ID_PREFIX}1`, `${COOKIELESS_DISTINCT_ID_PREFIX}2`])- })-- it('does not treat ids that merely contain "cookieless" as anonymous', () => {- const result = partitionDistinctIds(['user_with_cookieless_word', 'cookieless'])- expect(result.identified).toEqual(['user_with_cookieless_word', 'cookieless'])- expect(result.anonymous).toEqual([])- })-})--describe('aggregateRecordingCountsByPerson', () => {- it("sums counts across each person's distinct_ids", () => {- const persons = [- makePerson({ id: 'person-a', distinct_ids: ['d1', 'd2'] }),- makePerson({ id: 'person-b', distinct_ids: ['d3'] }),- ]- const counts = { d1: 2, d2: 3, d3: 1 }- expect(aggregateRecordingCountsByPerson(persons, counts)).toEqual({- 'person-a': 5,- 'person-b': 1,- })- })-- it('omits persons with zero recordings', () => {- const persons = [- makePerson({ id: 'person-a', distinct_ids: ['d1'] }),- makePerson({ id: 'person-b', distinct_ids: ['d2'] }),- ]- const counts = { d2: 4 }- expect(aggregateRecordingCountsByPerson(persons, counts)).toEqual({ 'person-b': 4 })- })-- it('falls back to uuid when id is missing', () => {- const persons = [makePerson({ uuid: 'uuid-1', distinct_ids: ['d1'] })]- expect(aggregateRecordingCountsByPerson(persons, { d1: 7 })).toEqual({ 'uuid-1': 7 })- })-- it('skips persons with no id and no uuid', () => {- const persons = [makePerson({ distinct_ids: ['d1'] })]- expect(aggregateRecordingCountsByPerson(persons, { d1: 1 })).toEqual({})- })-- it('ignores distinct_ids that are not present in the counts map', () => {- const persons = [makePerson({ id: 'person-a', distinct_ids: ['d1', 'd-missing'] })]- expect(aggregateRecordingCountsByPerson(persons, { d1: 2 })).toEqual({ 'person-a': 2 })- })-- it('returns an empty object when no persons have recordings', () => {- const persons = [makePerson({ id: 'person-a', distinct_ids: ['d1'] })]- expect(aggregateRecordingCountsByPerson(persons, {})).toEqual({})- })-})--describe('livePersonDrillDownDrawerLogic', () => {- let logic: ReturnType<typeof livePersonDrillDownDrawerLogic.build>-- beforeEach(() => {- initKeaTests()- logic = livePersonDrillDownDrawerLogic()- logic.mount()- })-- afterEach(() => {- logic.unmount()- })-- it('starts with no current selection', async () => {- await expectLogic(logic).toMatchValues({ currentSelection: null })- })-- it('opens a drill-down with the given selection', async () => {- const selection: LivePersonDrillDownSelection = {- breakdownType: 'country',- breakdownValue: 'US',- breakdownLabel: 'United States',- }- await expectLogic(logic, () => {- logic.actions.openDrillDown(selection)- }).toMatchValues({ currentSelection: selection })- })-- it('replaces the current selection when opening a different one', async () => {- logic.actions.openDrillDown({- breakdownType: 'country',- breakdownValue: 'US',- breakdownLabel: 'United States',- })- const next: LivePersonDrillDownSelection = {- breakdownType: 'browser',- breakdownValue: 'Chrome',- breakdownLabel: 'Chrome',- }- await expectLogic(logic, () => {- logic.actions.openDrillDown(next)- }).toMatchValues({ currentSelection: next })- })-- it('clears the selection on close', async () => {- logic.actions.openDrillDown({- breakdownType: 'country',- breakdownValue: 'US',- breakdownLabel: 'United States',- })- await expectLogic(logic, () => {- logic.actions.closeDrillDown()- }).toMatchValues({ currentSelection: null })- })-})diff --git a/frontend/src/scenes/web-analytics/LiveMetricsDashboard/livePersonDrillDownLogic.ts b/frontend/src/scenes/web-analytics/LiveMetricsDashboard/livePersonDrillDownLogic.tsdeleted file mode 100644index 63415e6f2623..000000000000--- a/frontend/src/scenes/web-analytics/LiveMetricsDashboard/livePersonDrillDownLogic.ts+++ /dev/null@@ -1,361 +0,0 @@-import { deepEqual as equal } from 'fast-equals'-import { MakeLogicType, actions, connect, events, kea, key, listeners, path, props, reducers, selectors } from 'kea'-import { loaders } from 'kea-loaders'--import { teamLogic } from 'scenes/teamLogic'-import { WEB_ANALYTICS_DEFAULT_QUERY_TAGS } from 'scenes/web-analytics/common'--import { performQuery } from '~/queries/query'-import { HogQLQueryResponse, NodeKind } from '~/queries/schema/schema-general'-import { hogql } from '~/queries/utils'-import { PersonType } from '~/types'--import { parsePersonFromHogQLRow } from 'products/persons/frontend/person-utils'--import type { TeamPublicType, TeamType } from '../../../types'-import { LiveMetricsSlidingWindow } from './LiveMetricsSlidingWindow'-import { LivePersonDrillDownBreakdownType, livePersonDrillDownDrawerLogic } from './livePersonDrillDownDrawerLogic'-import type { LivePersonDrillDownSelection } from './livePersonDrillDownDrawerLogic'-import { liveWebAnalyticsMetricsLogic } from './liveWebAnalyticsMetricsLogic'--export const COOKIELESS_DISTINCT_ID_PREFIX = 'cookieless_'-export const PERSON_HYDRATION_LIMIT = 200--export interface LivePersonDrillDownLogicProps {- breakdownType: LivePersonDrillDownBreakdownType- breakdownValue: string-}--export const partitionDistinctIds = (distinctIds: string[]): { identified: string[]; anonymous: string[] } => {- const identified: string[] = []- const anonymous: string[] = []- for (const id of distinctIds) {- if (id.startsWith(COOKIELESS_DISTINCT_ID_PREFIX)) {- anonymous.push(id)- } else {- identified.push(id)- }- }- return { identified, anonymous }-}--export const aggregateRecordingCountsByPerson = (- persons: PersonType[],- countsByDistinctId: Record<string, number>-): Record<string, number> => {- const byKey: Record<string, number> = {}- for (const person of persons) {- const key = person.id ?? person.uuid- if (!key) {- continue- }- let total = 0- for (const distinctId of person.distinct_ids ?? []) {- total += countsByDistinctId[distinctId] ?? 0- }- if (total > 0) {- byKey[key] = total- }- }- return byKey-}--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface livePersonDrillDownLogicValues {- currentSelection: LivePersonDrillDownSelection | null // livePersonDrillDownDrawerLogic- eventsVersion: number // liveWebAnalyticsMetricsLogic- geoVersion: number // liveWebAnalyticsMetricsLogic- slidingWindow: LiveMetricsSlidingWindow // liveWebAnalyticsMetricsLogic- currentTeam: TeamPublicType | TeamType | null // teamLogic- anonymousCount: number- currentDistinctIds: string[]- displayedDistinctIds: string[]- identifiedCount: number- identifiedDistinctIds: string[]- isTruncated: boolean- newVisitorCount: number- partitionedDistinctIds: {- anonymous: string[]- identified: string[]- }- persons: PersonType[]- personsLoading: boolean- recordingCountByPersonKey: Record<string, number>- recordingCountsByDistinctId: Record<string, number>- recordingCountsByDistinctIdLoading: boolean- totalCount: number-}--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface livePersonDrillDownLogicActions {- loadPersons: ({ distinctIds }: { distinctIds: string[] }) => {- distinctIds: string[]- }- loadPersonsFailure: (- error: string,- errorObject?: any- ) => {- error: string- errorObject?: any- }- loadPersonsSuccess: (- persons: PersonType[],- payload?: {- distinctIds: string[]- }- ) => {- persons: PersonType[]- payload?: {- distinctIds: string[]- }- }- loadRecordingCounts: ({ distinctIds }: { distinctIds: string[] }) => {- distinctIds: string[]- }- loadRecordingCountsFailure: (- error: string,- errorObject?: any- ) => {- error: string- errorObject?: any- }- loadRecordingCountsSuccess: (- recordingCountsByDistinctId: Record<string, number>,- payload?: {- distinctIds: string[]- }- ) => {- recordingCountsByDistinctId: Record<string, number>- payload?: {- distinctIds: string[]- }- }- refresh: () => {- value: true- }-}--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface livePersonDrillDownLogicMeta {- key: string- __keaTypeGenInternalSelectorTypes: {- currentDistinctIds: (- slidingWindow: LiveMetricsSlidingWindow,- eventsVersion: number,- geoVersion: number,- arg: any- ) => string[]- partitionedDistinctIds: (currentDistinctIds: string[]) => {- anonymous: string[]- identified: string[]- }- identifiedDistinctIds: (partitionedDistinctIds: { anonymous: string[]; identified: string[] }) => string[]- anonymousCount: (partitionedDistinctIds: { anonymous: string[]; identified: string[] }) => number- totalCount: (currentDistinctIds: string[]) => number- identifiedCount: (identifiedDistinctIds: string[]) => number- newVisitorCount: (identifiedDistinctIds: string[], displayedDistinctIds: string[]) => number- isTruncated: (identifiedCount: number) => boolean- recordingCountByPersonKey: (- persons: PersonType[],- recordingCountsByDistinctId: Record<string, number>- ) => Record<string, number>- }-}--export type livePersonDrillDownLogicType = MakeLogicType<- livePersonDrillDownLogicValues,- livePersonDrillDownLogicActions,- LivePersonDrillDownLogicProps,- livePersonDrillDownLogicMeta->--export const livePersonDrillDownLogic = kea<livePersonDrillDownLogicType>([- props({} as LivePersonDrillDownLogicProps),- key((p) => `${p.breakdownType}:${p.breakdownValue}`),- path((logicKey) => ['scenes', 'webAnalytics', 'livePersonDrillDownLogic', logicKey]),- connect(() => ({- values: [- liveWebAnalyticsMetricsLogic,- ['slidingWindow', 'eventsVersion', 'geoVersion'],- livePersonDrillDownDrawerLogic,- ['currentSelection'],- teamLogic,- ['currentTeam'],- ],- })),- actions({- refresh: true,- }),- loaders(({ values }) => ({- persons: [- [] as PersonType[],- {- loadPersons: async ({ distinctIds }: { distinctIds: string[] }) => {- const { identified } = partitionDistinctIds(distinctIds)- if (identified.length === 0) {- return []- }- const limitedIds = identified.slice(0, PERSON_HYDRATION_LIMIT)- const query = hogql`SELECT- id,- groupArray(101)(pdi2.distinct_id) AS distinct_ids,- properties,- is_identified,- created_at,- last_seen_at- FROM persons- LEFT JOIN (- SELECT- pdi2.distinct_id,- argMax(pdi2.person_id, pdi2.version) AS person_id- FROM raw_person_distinct_ids pdi2- WHERE pdi2.distinct_id IN (- SELECT distinct_id- FROM raw_person_distinct_ids- WHERE person_id IN (- SELECT argMax(person_id, version) AS person_id- FROM raw_person_distinct_ids- WHERE distinct_id IN ${limitedIds}- GROUP BY distinct_id- HAVING argMax(is_deleted, version) = 0- )- )- GROUP BY pdi2.distinct_id- HAVING argMax(pdi2.is_deleted, pdi2.version) = 0- ) AS pdi2 ON pdi2.person_id = persons.id- WHERE persons.id IN (- SELECT argMax(person_id, version) AS person_id- FROM raw_person_distinct_ids- WHERE distinct_id IN ${limitedIds}- GROUP BY distinct_id- HAVING argMax(is_deleted, version) = 0- )- GROUP BY id, properties, is_identified, created_at, last_seen_at- ORDER BY last_seen_at DESC- LIMIT ${PERSON_HYDRATION_LIMIT}`-- const response = (await performQuery({- kind: NodeKind.HogQLQuery,- query,- tags: WEB_ANALYTICS_DEFAULT_QUERY_TAGS,- })) as HogQLQueryResponse- return (response.results ?? []).map(parsePersonFromHogQLRow)- },- },- ],- recordingCountsByDistinctId: [- {} as Record<string, number>,- {- loadRecordingCounts: async ({ distinctIds }: { distinctIds: string[] }) => {- if (!values.currentTeam?.session_recording_opt_in) {- return {}- }- const { identified } = partitionDistinctIds(distinctIds)- if (identified.length === 0) {- return {}- }- const limitedIds = identified.slice(0, PERSON_HYDRATION_LIMIT)- const query = hogql`SELECT- distinct_id,- count(DISTINCT session_id) AS recording_count- FROM session_replay_events- WHERE distinct_id IN ${limitedIds}- AND min_first_timestamp >= now() - INTERVAL 30 MINUTE- GROUP BY distinct_id`-- const response = (await performQuery({- kind: NodeKind.HogQLQuery,- query,- tags: WEB_ANALYTICS_DEFAULT_QUERY_TAGS,- })) as HogQLQueryResponse- const rows = (response.results ?? []) as [string, number | string][]- const counts: Record<string, number> = {}- for (const [distinctId, recordingCount] of rows) {- const n = Number(recordingCount)- if (distinctId && Number.isFinite(n) && n > 0) {- counts[distinctId] = n- }- }- return counts- },- },- ],- })),- reducers({- displayedDistinctIds: [- [] as string[],- {- loadPersons: (_, { distinctIds }) => distinctIds,- },- ],- }),- selectors({- currentDistinctIds: [- (s) => [s.slidingWindow, s.eventsVersion, s.geoVersion, (_, p) => p],- (- slidingWindow: LiveMetricsSlidingWindow,- _eventsVersion: number,- _geoVersion: number,- props: LivePersonDrillDownLogicProps- ): string[] => slidingWindow.getDistinctIdsFor(props.breakdownType, props.breakdownValue),- { resultEqualityCheck: equal },- ],- partitionedDistinctIds: [- (s) => [s.currentDistinctIds],- (distinctIds: string[]): { identified: string[]; anonymous: string[] } => partitionDistinctIds(distinctIds),- { resultEqualityCheck: equal },- ],- identifiedDistinctIds: [- (s) => [s.partitionedDistinctIds],- (partitioned: { identified: string[] }): string[] => partitioned.identified,- ],- anonymousCount: [- (s) => [s.partitionedDistinctIds],- (partitioned: { anonymous: string[] }): number => partitioned.anonymous.length,- ],- totalCount: [(s) => [s.currentDistinctIds], (distinctIds: string[]): number => distinctIds.length],- identifiedCount: [(s) => [s.identifiedDistinctIds], (identified: string[]): number => identified.length],- newVisitorCount: [- (s) => [s.identifiedDistinctIds, s.displayedDistinctIds],- (current: string[], displayed: string[]): number => {- if (displayed.length === 0) {- return 0- }- const displayedSet = new Set(displayed)- let n = 0- for (const id of current) {- if (!displayedSet.has(id)) {- n++- }- }- return n- },- ],- isTruncated: [- (s) => [s.identifiedCount],- (identifiedCount: number): boolean => identifiedCount > PERSON_HYDRATION_LIMIT,- ],- recordingCountByPersonKey: [- (s) => [s.persons, s.recordingCountsByDistinctId],- (persons: PersonType[], counts: Record<string, number>): Record<string, number> =>- aggregateRecordingCountsByPerson(persons, counts),- { resultEqualityCheck: equal },- ],- }),- listeners(({ actions, values }) => ({- refresh: () => {- actions.loadPersons({ distinctIds: values.identifiedDistinctIds })- if (values.currentTeam?.session_recording_opt_in) {- actions.loadRecordingCounts({ distinctIds: values.identifiedDistinctIds })- }- },- })),- events(({ actions, values }) => ({- afterMount: () => {- actions.loadPersons({ distinctIds: values.identifiedDistinctIds })- if (values.currentTeam?.session_recording_opt_in) {- actions.loadRecordingCounts({ distinctIds: values.identifiedDistinctIds })- }- },- })),-])diff --git a/frontend/src/scenes/web-analytics/tiles/WebAnalyticsTile.tsx b/frontend/src/scenes/web-analytics/tiles/WebAnalyticsTile.tsxindex 5936f0c56a2c..81d53e3b51c8 100644--- a/frontend/src/scenes/web-analytics/tiles/WebAnalyticsTile.tsx+++ b/frontend/src/scenes/web-analytics/tiles/WebAnalyticsTile.tsx@@ -3,7 +3,7 @@ import { BuiltLogic, LogicWrapper, useActions, useValues } from 'kea'import { useCallback, useMemo } from 'react'import * as starPng from '@posthog/brand/hoggies/png/star'-import { IconChevronDown, IconExternal, IconTrending, IconUndo, IconWarning } from '@posthog/icons'+import { IconChevronDown, IconTrending, IconUndo, IconWarning } from '@posthog/icons'import { LemonSegmentedButton, LemonSelect, Link, Tooltip } from '@posthog/lemon-ui'import { pngHoggie } from 'lib/brand/hoggies'@@ -27,7 +27,6 @@ import {import { humanFriendlyDuration } from 'lib/utils/durations'import { UnexpectedNeverError } from 'lib/utils/guards'import { percentage } from 'lib/utils/numbers'-import { capitalizeFirstLetter } from 'lib/utils/strings'import { tryDecodeURIComponent } from 'lib/utils/url'import { teamLogic } from 'scenes/teamLogic'import { urls } from 'scenes/urls'@@ -116,111 +115,10 @@ const PAGE_LIKE_BREAKDOWNS = new Set([WebStatsBreakdown.FrustrationMetrics,])-const buildOpenUrl = (- breakdownBy: WebStatsBreakdown,- value: string,- effectiveDomain: string | null,- includeHost?: boolean-): string | null => {- if (!value || !PAGE_LIKE_BREAKDOWNS.has(breakdownBy)) {- return null- }-- // For ExitClick, the value is already a full URL- if (breakdownBy === WebStatsBreakdown.ExitClick) {- return value.startsWith('http') ? value : `https://${value}`- }-- // When includeHost is true, the value already contains host+path (e.g. example.com/about)- if (includeHost) {- return value.startsWith('http') ? value : `https://${value}`- }-- if (!effectiveDomain) {- return null- }-- // Parse the effectiveDomain to preserve its protocol (http vs https)- // Wrap in try/catch since domainFilter can be invalid (e.g., from URL params)- try {- const domainUrl = new URL(effectiveDomain)- const path = value.startsWith('/') ? value : `/${value}`- return `${domainUrl.origin}${path}`- } catch {- return null- }-}-const HedgehogStar = pngHoggie(starPng)-const PathValueWithHoverLink = ({- children,- breakdownBy,- value,- includeHost,-}: {- children: React.ReactNode- breakdownBy: WebStatsBreakdown- value: string- includeHost?: boolean-}): JSX.Element => {- const { effectiveDomain } = useValues(webAnalyticsFilterLogic)- const { featureFlags } = useValues(featureFlagLogic)- const url = buildOpenUrl(breakdownBy, value, effectiveDomain, includeHost)-- if (!url || !featureFlags[FEATURE_FLAGS.WEB_ANALYTICS_OPEN_URL]) {- return <>{children}</>- }-- return (- <span className="inline-flex items-center gap-1">- {children}- <Link- to={url}- target="_blank"- onClick={(e: React.MouseEvent) => e.stopPropagation()}- className="opacity-0 transition-opacity text-muted hover:text-primary [[data-row-key]:hover_&]:opacity-100"- >- <Tooltip title="Open URL">- <IconExternal className="text-base" />- </Tooltip>- </Link>- </span>- )-}--// Outbound clicks come through as a `url` column (not `breakdown_value`), so they don't get the-// PathValueWithHoverLink affordance. The value is already a full external URL.-const UrlValueCell: QueryContextColumnComponent = ({ value }) => {- const { featureFlags } = useValues(featureFlagLogic)-- if (typeof value !== 'string' || !value) {- return <>{value}</>- }-- if (!featureFlags[FEATURE_FLAGS.WEB_ANALYTICS_OPEN_URL]) {- return <>{value}</>- }-- const url = value.startsWith('http') ? value : `https://${value}`-- // The URL text itself is the click target so it stays discoverable on touch and keyboard focus,- // and works even when the cell's max-width clips the trailing icon. The icon is a hover-only hint.- return (- <Link- to={url}- target="_blank"- subtle- onClick={(e: React.MouseEvent) => e.stopPropagation()}- className="inline-flex items-center gap-1"- >- {value}- <Tooltip title="Open URL">- <IconExternal className="text-base opacity-0 transition-opacity [[data-row-key]:hover_&]:opacity-100" />- </Tooltip>- </Link>- )-}+// Outbound clicks come through as a `url` column, which the default renderer would turn into a link.+const UrlValueCell: QueryContextColumnComponent = ({ value }) => <>{value}</>type VariationCellProps = {isPercentage?: boolean@@ -434,7 +332,7 @@ const BreakdownValueCell: QueryContextColumnComponent = (props) => {if (source.kind !== NodeKind.WebStatsTableQuery) {return null}- const { breakdownBy, includeHost } = source+ const { breakdownBy } = sourceswitch (breakdownBy) {case WebStatsBreakdown.ExitPage:@@ -446,21 +344,13 @@ const BreakdownValueCell: QueryContextColumnComponent = (props) => {}const decoded = tryDecodeURIComponent(value)const displayValue = source.doPathCleaning ? parseAliasToReadable(decoded) : decoded- return (- <PathValueWithHoverLink breakdownBy={breakdownBy} value={value} includeHost={includeHost}>- {displayValue}- </PathValueWithHoverLink>- )+ return <>{displayValue}</>}case WebStatsBreakdown.ExitClick: {if (typeof value !== 'string') {return <>{value}</>}- return (- <PathValueWithHoverLink breakdownBy={breakdownBy} value={value}>- {value}- </PathValueWithHoverLink>- )+ return <>{value}</>}case WebStatsBreakdown.Viewport:if (Array.isArray(value)) {@@ -792,7 +682,6 @@ export const WebStatsTrendTile = ({const isDragToZoomEnabled = !!featureFlags[FEATURE_FLAGS.WEB_ANALYTICS_DRAG_TO_ZOOM]const worldMapPropertyName = webStatsBreakdownToPropertyName(WebStatsBreakdown.Country)?.keyconst regionPropertyName = webStatsBreakdownToPropertyName(WebStatsBreakdown.Region)?.key- const showComparisonLabels = !!featureFlags[FEATURE_FLAGS.WEB_ANALYTICS_TOOLTIP_COMPARISON_LABELS]const isWorldMap =query.source?.kind === NodeKind.TrendsQuery && query.source.trendsFilter?.display === ChartDisplayType.WorldMap@@ -845,21 +734,6 @@ export const WebStatsTrendTile = ({},compareFilter,onDateRangeZoom: isDragToZoomEnabled ? zoomIntoPeriod : undefined,- ...(showComparisonLabels- ? {- formatCompareLabel: (label: string, dateLabel?: string) => {- const lowerLabel = label.toLowerCase()- const dateSuffix = dateLabel ? ` (${dateLabel})` : ''- if (lowerLabel === 'previous') {- return `Previous${dateSuffix}`- }- if (lowerLabel === 'current') {- return `Current${dateSuffix}`- }- return capitalizeFirstLetter(label)- },- }- : {}),}// World maps need custom click handler for country filtering, trend lines use default persons modal@@ -901,7 +775,6 @@ export const WebStatsTrendTile = ({zoomIntoPeriod,insightPropsForQuery,query,- showComparisonLabels,isDragToZoomEnabled,isWorldMap,])diff --git a/frontend/src/scenes/web-analytics/webAnalyticsLogic.test.ts b/frontend/src/scenes/web-analytics/webAnalyticsLogic.test.tsindex 50cdf72665bf..2128a7796d22 100644--- a/frontend/src/scenes/web-analytics/webAnalyticsLogic.test.ts+++ b/frontend/src/scenes/web-analytics/webAnalyticsLogic.test.ts@@ -844,94 +844,13 @@ describe('webAnalyticsLogic URL restoration', () => {}})- const enableBackNavReset = (): void => {- featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.WEB_ANALYTICS_BACK_NAVIGATION_RESET], {- [FEATURE_FLAGS.WEB_ANALYTICS_BACK_NAVIGATION_RESET]: true,- })- }-- it('clears a drilled-in filter when navigating back to a URL without filters (flag on)', async () => {- enableBackNavReset()-+ it('leaves a drilled-in filter in place on back-navigation', async () => {router.actions.push('/web', { filters: [FILTER_A] })await expectLogic(logic).toFinishAllListeners()expect(logic.values.rawWebAnalyticsFilters).toEqual([FILTER_A])router.actions.push('/web')await expectLogic(logic).toFinishAllListeners()- expect(logic.values.rawWebAnalyticsFilters).toEqual([])- })-- it('keeps the outer filter when stepping back between two drill levels (flag on)', async () => {- enableBackNavReset()-- router.actions.push('/web', { filters: [FILTER_A, FILTER_B] })- await expectLogic(logic).toFinishAllListeners()- expect(logic.values.rawWebAnalyticsFilters).toEqual([FILTER_A, FILTER_B])-- router.actions.push('/web', { filters: [FILTER_A] })- await expectLogic(logic).toFinishAllListeners()- expect(logic.values.rawWebAnalyticsFilters).toEqual([FILTER_A])- })-- it.each<[string, string, () => unknown]>([- ['domain', 'example.com', () => logic.values.domainFilter],- ['device_type', 'Desktop', () => logic.values.deviceTypeFilter],- ['country', 'US', () => logic.values.countryFilter],- ['referrer', 'google.com', () => logic.values.referrerFilter],- ])(- 'clears a drilled-in %s filter when navigating back to a URL without it (flag on)',- async (param, value, read) => {- // These drill-downs fold into the query like `filters` do, so a back-navigation that- // omits the param must clear the value — otherwise the shown data no longer matches the URL.- featureFlagLogic.actions.setFeatureFlags(- [FEATURE_FLAGS.WEB_ANALYTICS_BACK_NAVIGATION_RESET, FEATURE_FLAGS.WEB_ANALYTICS_PAGE_PERFORMANCE],- {- [FEATURE_FLAGS.WEB_ANALYTICS_BACK_NAVIGATION_RESET]: true,- [FEATURE_FLAGS.WEB_ANALYTICS_PAGE_PERFORMANCE]: true,- }- )-- router.actions.push('/web/page-performance', { [param]: value })- await expectLogic(logic).toFinishAllListeners()- expect(read()).toBe(value)-- router.actions.push('/web/page-performance')- await expectLogic(logic).toFinishAllListeners()- expect(read()).toBeNull()- }- )-- it('leaves a drilled-in filter in place on back-navigation when the flag is off', async () => {- router.actions.push('/web', { filters: [FILTER_A] })- await expectLogic(logic).toFinishAllListeners()- expect(logic.values.rawWebAnalyticsFilters).toEqual([FILTER_A])-- router.actions.push('/web')- await expectLogic(logic).toFinishAllListeners()- expect(logic.values.rawWebAnalyticsFilters).toEqual([FILTER_A])- })-- it('keeps filters when moving to the Live tab, which never serializes them (flag on)', async () => {- enableBackNavReset()-- router.actions.push('/web', { filters: [FILTER_A] })- await expectLogic(logic).toFinishAllListeners()- expect(logic.values.rawWebAnalyticsFilters).toEqual([FILTER_A])-- router.actions.push('/web/live')- await expectLogic(logic).toFinishAllListeners()- expect(logic.values.rawWebAnalyticsFilters).toEqual([FILTER_A])- })-- it('keeps filters when a cold /web/bots load redirects to /web with the bots flag off (reset flag on)', async () => {- enableBackNavReset()- logic.actions.setWebAnalyticsFilters([FILTER_A])- await expectLogic(logic).toFinishAllListeners()- logic.cache.hasRestoredWebUrl = false-- router.actions.push('/web/bots')- await expectLogic(logic).toFinishAllListeners()expect(logic.values.rawWebAnalyticsFilters).toEqual([FILTER_A])})})diff --git a/frontend/src/scenes/web-analytics/webAnalyticsLogic.tsx b/frontend/src/scenes/web-analytics/webAnalyticsLogic.tsxindex a8ed021aacf7..a29030160970 100644--- a/frontend/src/scenes/web-analytics/webAnalyticsLogic.tsx+++ b/frontend/src/scenes/web-analytics/webAnalyticsLogic.tsx@@ -108,7 +108,6 @@ import {INITIAL_DATE_FROM,INITIAL_DATE_TO,INITIAL_INTERVAL,- INITIAL_WEB_ANALYTICS_FILTER,PathTab,ProductTab,SourceTab,@@ -3501,8 +3500,7 @@ export const webAnalyticsLogic: LogicWrapper<webAnalyticsLogicType> = kea<webAnareferrer,tile_visualizations,include_host_path,- }: Record<string, any>,- isInitialRestore: boolean+ }: Record<string, any>): void => {if (![@@ -3551,8 +3549,6 @@ export const webAnalyticsLogic: LogicWrapper<webAnalyticsLogicType> = kea<webAnareturn}- cache.hasRestoredWebUrl = true-// Stamp the last-used timestamp for feature flag targeting (throttled to once per day per browser).const stampKey = `ph_last_web_analytics_stamp_${posthog.get_distinct_id()}`const oneDayMs = 24 * 60 * 60 * 1000@@ -3577,18 +3573,9 @@ export const webAnalyticsLogic: LogicWrapper<webAnalyticsLogicType> = kea<webAna}}- const tabSerializesFilters =- productTab !== ProductTab.LIVE &&- productTab !== ProductTab.HEALTH &&- productTab !== ProductTab.CONTENT_AUTOPILOT- const shouldResetAbsentFilters =- !isInitialRestore && !!values.featureFlags[FEATURE_FLAGS.WEB_ANALYTICS_BACK_NAVIGATION_RESET]-const parsedFilters = filters ? (isWebAnalyticsPropertyFilters(filters) ? filters : []) : undefinedif (parsedFilters) {applyRestoredFilters(parsedFilters)- } else if (shouldResetAbsentFilters && tabSerializesFilters) {- applyRestoredFilters(INITIAL_WEB_ANALYTICS_FILTER)}if (conversionGoalActionId &&@@ -3652,38 +3639,17 @@ export const webAnalyticsLogic: LogicWrapper<webAnalyticsLogicType> = kea<webAnaif (percentile && percentile !== values.webVitalsPercentile) {actions.setWebVitalsPercentile(percentile as WebVitalsPercentile)}- // Drill-down filters fold into the query the same way `filters` does, so on a- // back-navigation to a URL that omits one, clear it instead of leaving the newer- // value applied, because otherwise the shown data can't be reproduced from the URL.if (domain && domain !== values.domainFilter) {actions.setDomainFilter(domain === 'all' ? null : domain)- } else if (!domain && shouldResetAbsentFilters && tabSerializesFilters && values.domainFilter !== null) {- actions.setDomainFilter(null)}if (device_type && device_type !== values.deviceTypeFilter) {actions.setDeviceTypeFilter(device_type)- } else if (- !device_type &&- shouldResetAbsentFilters &&- tabSerializesFilters &&- values.deviceTypeFilter !== null- ) {- actions.setDeviceTypeFilter(null)}if (country && country !== values.countryFilter) {actions.setCountryFilter(country)- } else if (!country && shouldResetAbsentFilters && tabSerializesFilters && values.countryFilter !== null) {- actions.setCountryFilter(null)}if (referrer && referrer !== values.referrerFilter) {actions.setReferrerFilter(referrer)- } else if (- !referrer &&- shouldResetAbsentFilters &&- tabSerializesFilters &&- values.referrerFilter !== null- ) {- actions.setReferrerFilter(null)}if (tile_visualizations && !objectsEqual(tile_visualizations, values.tileVisualizations)) {for (const [tileId, visualization] of Object.entries(tile_visualizations)) {@@ -3732,10 +3698,9 @@ export const webAnalyticsLogic: LogicWrapper<webAnalyticsLogicType> = kea<webAna// into a burst of redundant URL evaluations and trip the rapid-URL-change detector. The depth// counter keeps the guard correct if a restore re-enters (e.g. the bots-flag redirect).const toAction = (params: { productTab?: ProductTab }, searchParams: Record<string, any>): void => {- const isInitialRestore = !cache.hasRestoredWebUrlcache.applyUrlStateDepth = (cache.applyUrlStateDepth ?? 0) + 1try {- applyUrlState(params, searchParams, isInitialRestore)+ applyUrlState(params, searchParams)} finally {cache.applyUrlStateDepth -= 1}