fix(replay): redirect saved filters from playlist routes - #71505
Conversation
Redirect filter-type playlist URLs to the canonical replay saved-filter URL and update the legacy navigation link to avoid generating invalid routes. Generated-By: PostHog Code Task-Id: 3ee3da14-5e17-4f04-baf2-69a3ce904551
🤖 CI report
|
| Root | Eager (shipped) | Δ vs base | Budget |
|---|---|---|---|
entry (logged-out pages, app bootstrap)src/index.tsx |
1.22 MiB · 22 files | no change | ███░░░░░░░ 28.4% of 4.29 MiB |
authenticated shell (every logged-in page)src/scenes/AuthenticatedShell.tsx |
8.13 MiB · 2,981 files | 🔺 +163 B (+0.0%) | █████████░ 87.9% of 9.25 MiB |
🟢 node_modules/monaco-editor/ stays out of src/index.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/index.tsx
🟢 [object Object] stays out of src/index.tsx
🟢 [object Object] stays out of src/index.tsx
🟢 node_modules/monaco-editor/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/scenes/AuthenticatedShell.tsx
🟢 [object Object] stays out of src/scenes/AuthenticatedShell.tsx
🟢 [object Object] stays out of src/scenes/AuthenticatedShell.tsx
Largest files eagerly shipped from src/index.tsx
| Size | File |
|---|---|
| 126.8 KiB | ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js |
| 24.6 KiB | ../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js |
| 6.3 KiB | ../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js |
| 4.5 KiB | ../node_modules/.pnpm/@jspm+core@2.1.0/node_modules/@jspm/core/nodelibs/browser/process.js |
| 3.9 KiB | ../node_modules/.pnpm/scheduler@0.23.2/node_modules/scheduler/cjs/scheduler.production.min.js |
| 1.4 KiB | ../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js |
| 1.3 KiB | src/RootErrorBoundary.tsx |
| 912 B | ../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js |
| 789 B | src/scenes/ChunkLoadErrorBoundary.tsx |
| 762 B | src/index.tsx |
Largest files eagerly shipped from src/scenes/AuthenticatedShell.tsx
| Size | File |
|---|---|
| 281.3 KiB | ../node_modules/.pnpm/posthog-js@1.402.3/node_modules/posthog-js/dist/rrweb.js |
| 267.7 KiB | ../node_modules/.pnpm/@posthog+icons@0.38.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js |
| 235.5 KiB | src/taxonomy/core-filter-definitions-by-group.json |
| 222.9 KiB | ../node_modules/.pnpm/posthog-js@1.402.3/node_modules/posthog-js/dist/module.js |
| 164.0 KiB | src/queries/validators.js |
| 154.3 KiB | ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js |
| 126.8 KiB | ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js |
| 105.8 KiB | src/lib/api.ts |
| 93.3 KiB | ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js |
| 92.7 KiB | ../packages/quill/packages/quill/dist/index.js |
Posted automatically by check-eager-graph · sizes are eager output bytes (shipped, post-tree-shake) from the esbuild metafile · part of #32479
✅ Dist folder size — 🔺 +2.4 KiB (+0.0%)
Total size of the built frontend/dist folder (all assets), compared against the base branch.
Total: 1312.84 MiB · 🔺 +2.4 KiB (+0.0%)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 05f98a3b73
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| getPlaylistSuccess: ({ playlist }) => { | ||
| if (playlist?.type === 'filters') { | ||
| router.actions.replace( | ||
| combineUrl(urls.replay(ReplayTabs.Home), { savedFilterId: playlist.short_id }).url |
There was a problem hiding this comment.
Apply saved filters after the redirect
For a bookmarked or in-app /replay/playlists/<saved-filter-id> route, this only replaces the URL with savedFilterId; the code that consumes that param is sessionRecordingSavedFiltersLogic.afterMount() and it runs only once. Since the navigation already mounts that logic to populate saved filters, the one-shot check has usually run before this redirect adds the param, so Replay home can render with default or stale filters even though the URL looks canonical. Make saved-filter application react to URL changes, or apply the loaded filter directly before/while redirecting.
Useful? React with 👍 / 👎.
Problem
Saved-filter playlists can be opened at
/replay/playlists/:id, even though that scene is only valid for collection playlists. Loading a saved filter there also triggers playlist-only update behavior before the user reaches the recordings view.Why: Saved filters should always open in the replay recordings view where their filters can be applied and edited.
Inbox report: https://us.posthog.com/project/2/inbox/019e18c7-1d63-7ace-bd34-17bf9d88bd57
Changes
type: 'filters'playlist loads to/replay/home?savedFilterId=:idbefore playlist-only side effects run.How did you test this code?
pnpm --filter=@posthog/frontend jest frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistSceneLogic.test.ts --runInBandpnpm exec oxlint --quiet frontend/src/layout/navigation-3000/navigationLogic.tsx frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistSceneLogic.ts frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistSceneLogic.test.tsgit diff --checkThe regression test catches filter-type playlists remaining on the collection playlist scene or firing the automatic playlist update during redirect.
Full frontend typecheck could not complete because this clean checkout is missing generated Kea
*Type.tsfiles across unrelated frontend and product modules.hogli ci:preflight --fixcould not run because the runner has no synced flox/uv Python environment.👉 Stay up-to-date with PostHog coding conventions for a smoother review.
Automatic notifications
Docs update
No documentation update is needed. This restores the existing saved-filter URL behavior.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
PostHog Code used the
/inbox-explorationand/writing-testsskills. The Inbox report originally suggested loosening backend PATCH validation, but the requested product behavior is to treat filter playlists as invalid for the playlist scene. The implementation redirects old or bookmarked playlist URLs and fixes the remaining navigation source that generated them.The GitHub App token could not resolve the directing user's GitHub identity, so the draft is left unassigned rather than assigning an unverified account.
Created with PostHog Code from an inbox report