Skip to content

: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.

fix(web-analytics): stop Live tab 404 and page reports param loss (#78066)

posthog[bot]e2aff5383e5e
diff --git a/frontend/src/scenes/web-analytics/WebAnalyticsDashboard.tsx b/frontend/src/scenes/web-analytics/WebAnalyticsDashboard.tsx
index 3ec89e93279f..ccbf02320150 100644
--- a/frontend/src/scenes/web-analytics/WebAnalyticsDashboard.tsx
+++ b/frontend/src/scenes/web-analytics/WebAnalyticsDashboard.tsx
@@ -718,7 +718,7 @@ const liveTab = (): { key: ProductTab; label: string | JSX.Element; link: string
{
key: ProductTab.LIVE,
label: 'Live',
- link: '/web/live',
+ link: urls.webAnalyticsLive(),
},
]
}
diff --git a/frontend/src/scenes/web-analytics/pageReportsLogic.test.ts b/frontend/src/scenes/web-analytics/pageReportsLogic.test.ts
index cf573da457f8..5a71a942d5f9 100644
--- a/frontend/src/scenes/web-analytics/pageReportsLogic.test.ts
+++ b/frontend/src/scenes/web-analytics/pageReportsLogic.test.ts
@@ -1,6 +1,17 @@
+import { router } from 'kea-router'
+import posthog from 'posthog-js'
+
+import api from 'lib/api'
+
+import { initKeaTests } from '~/test/init'
import { PathCleaningFilter, PropertyOperator } from '~/types'
-import { buildPageUrlOptions, cleanPageURLForDisplay, createPageReportsFilters } from './pageReportsLogic'
+import {
+ buildPageUrlOptions,
+ cleanPageURLForDisplay,
+ createPageReportsFilters,
+ pageReportsLogic,
+} from './pageReportsLogic'
describe('createPageReportsFilters', () => {
const hostFilters = (
@@ -200,3 +211,32 @@ describe('buildPageUrlOptions', () => {
])
})
})
+
+describe('pageReportsLogic setPageUrl', () => {
+ let logic: ReturnType<typeof pageReportsLogic.build>
+
+ beforeEach(() => {
+ initKeaTests()
+ jest.spyOn(api, 'query').mockResolvedValue({ results: [] } as any)
+ jest.spyOn(api.propertyDefinitions, 'list').mockResolvedValue({ results: [] } as any)
+ jest.spyOn(api.hogFunctions, 'list').mockResolvedValue({ results: [] } as any)
+ ;(posthog as any).setPersonProperties = jest.fn()
+ logic = pageReportsLogic()
+ logic.mount()
+ })
+
+ afterEach(() => {
+ logic.unmount()
+ jest.restoreAllMocks()
+ })
+
+ test('picking a page URL keeps other search params instead of replacing them', () => {
+ router.actions.push('/web/page-reports', { domain: 'posthog.com' })
+ const paramsBeforePick = router.values.searchParams
+
+ logic.actions.setPageUrl('/pricing')
+
+ expect(router.values.searchParams).toEqual({ ...paramsBeforePick, pageURL: '/pricing' })
+ expect(router.values.searchParams.domain).toEqual('posthog.com')
+ })
+})
diff --git a/frontend/src/scenes/web-analytics/pageReportsLogic.ts b/frontend/src/scenes/web-analytics/pageReportsLogic.ts
index 342522868c61..6421d9c8aff2 100644
--- a/frontend/src/scenes/web-analytics/pageReportsLogic.ts
+++ b/frontend/src/scenes/web-analytics/pageReportsLogic.ts
@@ -1268,9 +1268,6 @@ export const pageReportsLogic = kea<pageReportsLogicType>({
setPageUrlSearchTerm: ({ searchTerm }) => {
actions.loadPages(searchTerm)
},
- setPageUrl: ({ url }) => {
- router.actions.replace('/web/page-reports', url ? { pageURL: url } : {}, router.values.hashParams)
- },
loadPages: ({ searchTerm }) => {
actions.loadPagesUrls({ searchTerm })
},
diff --git a/frontend/src/scenes/web-analytics/tiles/WebAnalyticsRecordings.tsx b/frontend/src/scenes/web-analytics/tiles/WebAnalyticsRecordings.tsx
index 68e3d29c744a..2ac4afcfb84b 100644
--- a/frontend/src/scenes/web-analytics/tiles/WebAnalyticsRecordings.tsx
+++ b/frontend/src/scenes/web-analytics/tiles/WebAnalyticsRecordings.tsx
@@ -9,6 +9,7 @@ import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'
import { LemonTable } from 'lib/lemon-ui/LemonTable'
import { ProfilePicture } from 'lib/lemon-ui/ProfilePicture'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import { useAttachedLogic } from 'lib/logic/scenes/useAttachedLogic'
import { humanFriendlyDuration } from 'lib/utils/durations'
import { asDisplay } from 'scenes/persons/person-utils'
import { ActivityScoreLabel } from 'scenes/session-recordings/components/RecordingRow'
@@ -33,6 +34,7 @@ export function WebAnalyticsRecordingsTile({ tile }: { tile: ReplayTile }): JSX.
logicKey: 'webAnalytics',
filters: replayFilters,
})
+ useAttachedLogic(sessionRecordingsListLogicInstance, webAnalyticsLogic)
const { sessionRecordings, sessionRecordingsResponseLoading } = useValues(sessionRecordingsListLogicInstance)
const items = sessionRecordings.slice(0, 5)
diff --git a/frontend/src/scenes/web-analytics/webAnalyticsLogic.tsx b/frontend/src/scenes/web-analytics/webAnalyticsLogic.tsx
index 00ac6a364d9a..663e2fa7bfec 100644
--- a/frontend/src/scenes/web-analytics/webAnalyticsLogic.tsx
+++ b/frontend/src/scenes/web-analytics/webAnalyticsLogic.tsx
@@ -3078,7 +3078,7 @@ export const webAnalyticsLogic = kea<webAnalyticsLogicType>([
if (productTab === ProductTab.HEALTH) {
return urls.webAnalyticsHealth()
} else if (productTab === ProductTab.LIVE) {
- return '/web/live'
+ return urls.webAnalyticsLive()
} else if (productTab === ProductTab.BOT_ANALYTICS) {
// Bot tab maintains its own filter state in `botAnalyticsLogic`, so we serialize
// those filters here instead of `rawWebAnalyticsFilters` (which only describes the