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.

chore(replay): remove templates flag and comments tab (#110129)

Hayne Ryu5d34eb076edc
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index f4184ca62742..8eedceede93d 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -7714,14 +7714,6 @@ snapshots:
hash: v1.k794b7964.e0b88639193593d2310eb018f49347a9bb33a0cb1c2d709eb4123cea650151c9.MBJ1QFzWoPfRJD6kFjienFZcvIbeOXG63IgbNcH3BgM
replay-tabs-collections--recordings-play-lists--light:
hash: v1.k794b7964.f903e9b0791fe14a54094c6d60ebf2f783b038c3af2cd48a4b683405e0fa9804.T5HCxaEs6jav9oxx4Xh3I7cpQE5LAHe5hxr3m8mPZiU
- replay-tabs-comments--replay-comments--dark:
- hash: v1.k794b7964.6af2d3cc255214b5e3cc09e79f04b2f89d886ade9ccedbcb4580dc3911806f8c.tliRHNyKfL63iDI1FAb-nA3Dl05I3XJa_MEbL9MqKco
- replay-tabs-comments--replay-comments--light:
- hash: v1.k794b7964.e084d3db7021bff811b705c4f777541c4cfb0c46b8c7c86fac2c86723aba72ba.nh9hurj8GifHuw1FAk0p14LP7MwxM2Rdp00tVZCWwxw
- replay-tabs-comments--replay-comments-empty--dark:
- hash: v1.k794b7964.c2db163d8ad51841c9b652d731f6583685e5c52db268775903475272f6b8877f.qX_vfdLEALxvKOM-X_7BCcAVsLFsEqSYoE67GZycd-Q
- replay-tabs-comments--replay-comments-empty--light:
- hash: v1.k794b7964.eacc112601665aaad99a28267264805387b57496ee35b89bafef74db2c2c2794.pTNBJCYNg6D28_QldfksZRa-Bzl-VSAcEWzL5AeegF8
replay-tabs-home-failure--not-found--dark:
hash: v1.k794b7964.b9a8cf652792ff2c0bd190c60a09632c19b4d185a26cd90bd1778a70602948d7.VxjlB-GndCf740MtiPkEF0T7pY69VB1RDP9D1MH5DhY
replay-tabs-home-failure--not-found--light:
@@ -7735,41 +7727,41 @@ snapshots:
replay-tabs-home-filters-banner--event-match-scope-whole-session--light:
hash: v1.k794b7964.0c64840424d0bdce4d10bed232350a4759e96158ebe995b7b8428b0ba7898619.cidxUqOJpbqLUWD0V5qQlVME_qXgvxCuqLF26XNECJQ
replay-tabs-home-filters-banner--page-filter-nudge--dark:
- hash: v1.k794b7964.ef10ad389f863bfe246e69dc7bb0c74c3735cede108e2d373aa5b8338446b424.ewXseA-JwXOXnnzhCjOxwWoEzJiNIQsRDSepEBEsJ2Q
+ hash: v1.k794b7964.9980796a29c1881e8f0f3272e15db070c0b888807c614ef1a8e4ada1527bd70a.Cdb3WDppuFHABvopvXCTMQFkMFOMPf-JrLDhStAoplU
replay-tabs-home-filters-banner--page-filter-nudge--light:
- hash: v1.k794b7964.70291100d3b07d19ad57c2fc958920200e322040323cbfb85e16c4fc0a371eb4.CFadn9hS-m9BKKh9E_6MQl_zaxGXf4g271-3Itdu36I
+ hash: v1.k794b7964.2639b71d2d8dae96edd02c135175da5ad1d8ddd8906b2d89258198c39e686005.Y06el0AwUPE9g26lSyTOnv_CTpVpkzLFA-5IYhjYLfk
replay-tabs-home-filters-banner--product-analytics-over-limit--dark:
- hash: v1.k794b7964.883e2ce17802aabbf305467eedc51d55a3e3124e0d7d2998bb5c6fa387cc3833.wNyrJ_SnfMs_avoMKlU0Be48_3LzYlt_S3e1Lh1dd7w
+ hash: v1.k794b7964.a96879fbe286cc5873de1eb14d1271c14d6bf0d643c1e81e7b062105d1b4290b.Ugp6tIL0Ko_Q5N-CX6LYOftldrMVE-6219bkhvC25qM
replay-tabs-home-filters-banner--product-analytics-over-limit--light:
- hash: v1.k794b7964.32876fc8c32af514bcfc9cea32146281a61fd1fcc5c19afd1462bf04678bbf90.YCvY-DO2NvUY4beOqwkx2EBxcvnn2yEmBfiRl3IkjIA
+ hash: v1.k794b7964.b4e2ae0bda29040f464ea8da51a358ba7ca0018f9eb88384bee57ac4098c5afe.gl6zOVqxm3synSkmGaCUwtNC-Y2oJ3UljwTxUn2dvos
replay-tabs-home-filters-banner--product-analytics-under-limit--dark:
- hash: v1.k794b7964.5afe8e8639e305ff83e8efd5cf59af1c84468755028d07c5dfd21e7534cadbf0.vbE8VtSElMukmzXXJYYctZludMBuwDAr0IhrEG6bBe0
+ hash: v1.k794b7964.597d2766b744640b791bef770cc8627f913b22af142c47e713619da0b6974656.sbtdEmN5J78Vw9h-ssdO8_YminuhoHr2ooEmeqddLDA
replay-tabs-home-filters-banner--product-analytics-under-limit--light:
- hash: v1.k794b7964.096b1442282e47fb65e6afe3f0ae83b97c073b704ab768ecf3f55b1a452e7af3.xEGzC6R89bZ0hhQCHj8LM-kYQkCEyGmqx49B6yNkBHo
+ hash: v1.k794b7964.1fe7378d0c5eeb12ce6e53a69c957d9901cb33fe2eace481defffa5692104f73.o7YQajmukR99f0dfzmksfaJ_qaZJcS89v8IXGaE26ds
replay-tabs-home-filters-banner--scanner-cross-sell--dark:
- hash: v1.k794b7964.e0739c35f8f7e91dcc0eec9b0856ee24a4c427e365452b0998d753d58d689c08.xOCTBim155zwc_C3P-gZcul8rKMVsWypI4Dy9u_1Fxc
+ hash: v1.k794b7964.aa0f25717c6d7a7c48fcdbe35e3e98cb52d768a88c030381742ed842c2c22860.MXSs3Wuy86ob_eTNuFd6lEkyBoZcxkFD7cVAr6yS_ZY
replay-tabs-home-filters-banner--scanner-cross-sell--light:
- hash: v1.k794b7964.f7737d364d17d814799515a49367354f049f8b8fa49bc47bc6f3fd9def2fc6aa.1QjsRrQwtB0d-7QTtiHkJH1b6GyCHE6teVTo_7M7owE
+ hash: v1.k794b7964.a4fdc146d600c752e72554d5bd079d2981be506c4c19bed6ad08f84e00b203b3.f5EfKZ1bbdCl1iJL30c_slExwXSj2aCVLZCnvUuWhKQ
replay-tabs-home-filters-banner--templates-tab--dark:
hash: v1.k794b7964.821408e248503db259ac3cfedf8189f2cc20d9bb2fd3ea2148c5f016d9626471.3W4sY8uzOBOrdHKk0KYAAVdbJyKgArelBDA4AbiiKhU
replay-tabs-home-filters-banner--templates-tab--light:
hash: v1.k794b7964.9e38e553e9fcd165d4572edcfd24c6eac9a4958846e3cbc8c3daf85b8d60af19.Qef4EsSsp39XzM0OQXwhW-0Q1GUfNwizkHBaqrDxxhg
replay-tabs-home-success--filters-expanded--dark:
- hash: v1.k794b7964.a05acdcbac185e041adaf30a6d8ef4977978907164381eba3d3dc9c9d8aea04d.qKdFMomWAKqzXhor-Jl8T1XN8Kgp4pdrZiklEnoryuI
+ hash: v1.k794b7964.86f188a6d387f56b5b6577cd49ebad8444dea00aae460e44179115f6e50ba288.WWBd14pa3BjyvC9nd2NlJi19jQ3ToAo-HPn6aaN7vCw
replay-tabs-home-success--filters-expanded--light:
- hash: v1.k794b7964.1ef719a536f8c61fe0b072e8f68de8cc6bef36189d1a52e9b8f49ade040cc8fa.HEsAWe4GrGfsBm1O6lvgSkE-Chv5Tq3lGBPC4ZuJPx4
+ hash: v1.k794b7964.934e08bfbfd4eb8329a31cb1a0bb6224b9673b39f32bd4a113151236abdea72c.jw6VvIfcOhqhnA0JI6r-tL3R0QF1YBtIx19o0gta7sM
replay-tabs-home-success--filters-expanded-lots-of-results--dark:
- hash: v1.k794b7964.d155a139e5e1d6388a3950fa150338ca8357c13632f354cdde5ed7dc19e599ac.Jrs8QdMoU7XZcsTlpCafPTGTRNMZOe7sMu3e3leWWMg
+ hash: v1.k794b7964.b3d8882abcf9b20b12d7064004a683f06baa7b39a7a912d490d052f9de87c955.gCqivwQTplw-N4ybxxlPxYpOEy0YEp-wRgjNK_5Vfao
replay-tabs-home-success--filters-expanded-lots-of-results--light:
- hash: v1.k794b7964.7055e083d7b1a9426407494d1b6141e6d66b2096d265809da69183a731605363.0l7CwH5ete1qWt-cfn6NEeZcimjhizln2ce67oBJ5Zo
+ hash: v1.k794b7964.dcce277ea00b0b5e9273655c3ad74c926717dd1dd136a609ce36e3e86a6f5c7e.1mWHRNS1G1kvWLG2IUBLlzjrHHg-Y2n8uhR6hsXuDW8
replay-tabs-home-success--filters-expanded-lots-of-results-narrow--dark:
- hash: v1.k794b7964.0d914c8ec3c5beba7bca53b7364f18bcfe675b95d3a912e08ad62e33ec41226f.oSRJtsNoyVhqAtjsvvzypyt8WbJ2M2vDKlZTwIvTsRQ
+ hash: v1.k794b7964.40e33c2a6272fc7ad2b64a79ce1f5d49dc00ac1a21f8384ab61e7614df62fa14.vLsYzAJsQjuHNwWZC1wYnZwpAdEXK3CCFzro8MqhhmE
replay-tabs-home-success--filters-expanded-lots-of-results-narrow--light:
- hash: v1.k794b7964.46291f5cceabf5a2d9f1f514e60cc1ef214abbdee5ae26c6ea68591ce0d2f289.OR8N4L5BThnbqXgvDm_GeVt-fOffW2S7PKPgxrGnp4I
+ hash: v1.k794b7964.ef451e41d202695c0490ef4088e40efcd3f440083f735b099cab49247cffe2fc.qe-ZsObyslKaftOrmdcaqnvPJZEccmSsvJI7F0-g7HM
replay-tabs-home-success--recent-recordings--dark:
- hash: v1.k794b7964.0073c5938eb58b2f46998705da2f7057af76a33672895d3d62ebfa73fb10b35b.X0SVL-b3I11Gnd4z_tqve-gEpqiWfWVzNbqvu1Do7gs
+ hash: v1.k794b7964.53489d52d033d0e1c71a859505e5495bce5047fb8da1bb9a93cffdcd71b4df56.uv9ngEh2cTd6Pl7KULJymnBeIviUvt1Ou5f2TGCNM9k
replay-tabs-home-success--recent-recordings--light:
- hash: v1.k794b7964.3d26e4bebc2707c150626fd017c46ccd68b25dd8a5b10125d12d89b33c9595ba.Sif1Rhezuoon8YFPlJQfn74x2A34m1vBQJKM24iF4-4
+ hash: v1.k794b7964.b6b045f2dc7428e8138ecc3c45707abba1e6d2ed6ea32e2aefd2b6ee897406cb.ef2wK9r1pzyo5Q1nrIpIhNsn5DDC7JTCEQsNo0UeiEw
replay-tabs-home-success--recent-recordings-empty--dark:
hash: v1.k794b7964.b96eb8ff3becd42ef223773f142db0fb5a5c7d743adcce158cb164940f170c20.5aj7iROHwfdLWjLstJZEx3YzsXaFoHJbn4sok-n-0XM
replay-tabs-home-success--recent-recordings-empty--light:
@@ -7779,9 +7771,9 @@ snapshots:
replay-tabs-home-success--recordings-play-list-no-pinned-recordings--light:
hash: v1.k794b7964.a0683ea0a59c86f2d0b3245db8fe807ae82271c393971cece0c7b9c58f0e2f10.UjlpwjlWZaZS9fN-ph4xozP-XM8jx4p4M3MsEYFJpMs
replay-tabs-home-success--second-recording-in-list--dark:
- hash: v1.k794b7964.ee93f81501a6dfd56393b9c0eceacc7cb9f9670f5ddf734236fda11e5cd33c5e.3e5Mttfwj51jabXjO98LYD8X1VjqjG0INjIR6MhYTcs
+ hash: v1.k794b7964.69acc2781af6db4a887b8cae0093a1b913fe5995e7b795fa4f0e3a7d4911cf08.knfck7uN_gIA4zEimD2w7UuhA09LwOpig0CWG6eGAuw
replay-tabs-home-success--second-recording-in-list--light:
- hash: v1.k794b7964.67432ed1361bed1941a974b0aca88292b9706a400602e744941d25befe936a2a.yjX4pwB9QmSS39vtS05r2p9t3R-G_Ef2gXztPTfyWqM
+ hash: v1.k794b7964.ca5a857f71dd253cdf865a2555547945f3ee6e0c8267fdce3a0f68405608209a.ajJekZzCbHeYtB-T0URwjsqZKOULm_BioamuiXO5W7w
replay-vision-analysis-nudge--default--dark:
hash: v1.k794b7964.e21450a1b2054a36fab2a183fd4485190e7161c07830a04008b734f83ecabb1c.Hj2ygumZlfd2zAIz7tC6m7XoM-G15hY_amDmI_m-cJo
replay-vision-analysis-nudge--default--light:
@@ -11651,7 +11643,7 @@ snapshots:
scenes-app-notebooks-widget-views--person-views--light:
hash: v1.k794b7964.2d62f4b20d69c9a40eae3c8d3a624ba0b357518a02ec7ca93dbd5c6e242e201e.LgsC1L0SjCtp20JuRGzVImzFyRMi1p9rpp4rS6Q_jg4
scenes-app-notebooks-widget-views--recording-playlist-views--dark:
- hash: v1.k794b7964.348e1cd39145cc74118e51b175e384003180756ed2e37f059d7377f4e59bc337.6_JpQpRvZD6qtG1waq0WNkr8zlUs-XVfX8rLLpds5Q0
+ hash: v1.k794b7964.f26190194884a2d7ed0d9d64119ccb49e44467af7ccb258920c6a24129ae6cc6.m_ZO8dDcw0wEsXLRDi4RDh9hZerm36xA3yRKOvy1OAE
scenes-app-notebooks-widget-views--recording-playlist-views--light:
hash: v1.k794b7964.d6d85a23ed17ab1b418b156f362437fa2369ed39905e69a704c53fb061477ab2.2EykVptJR2onjXvaVpcSA6_tGXx6WSkK5sH8mAHIms0
scenes-app-notebooks-widget-views--recording-views--dark:
diff --git a/frontend/src/initKea.ts b/frontend/src/initKea.ts
index e3690b87c0e6..ccdc966d8521 100644
--- a/frontend/src/initKea.ts
+++ b/frontend/src/initKea.ts
@@ -86,7 +86,6 @@ const ERROR_FILTER_ALLOW_LIST = [
'loadRuns', // The Wizard runs table shows a persistent stale-data banner; a poll failure must not toast every 10s
'loadRunDetails', // The Wizard run drawer shows a stale-state banner with a retry
'cancelRunRequest', // wizardRunDetailsLogic shows its own cancel-failure toast
- 'loadReplayComments', // The replay Comments tab renders its own retry state
'loadCoreMemory', // The PostHog AI memory setting renders its own load error banner with a retry
'updateCoreMemory', // maxSettingsLogic's updateCoreMemoryFailure listener shows its own save-failure toast
'loadSessionEventDeltas', // The experiment watch shelf renders the refusal, or the failure with a retry
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 17ea1d9e1d3a..aad4a98ffdab 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -496,7 +496,6 @@ export const FEATURE_FLAGS = {
REPLAY_NEGATIVE_EVENT_FILTERS: 'replay-negative-event-filters', // owner: @arnohillen #team-replay
REPLAY_PLAYLIST_SURFACING_SCORE: 'replay-playlist-surfacing-score', // owner: #team-replay
REPLAY_RECOMMENDED_RECORDINGS_FILTER_EXPERIMENT: 'replay-recommended-recordings-filter-experiment', // owner: @arnohillen #team-replay multivariate=control,test
- REPLAY_TEMPLATES_IN_FILTERS_PANEL_EXPERIMENT: 'replay-templates-in-filters-panel-experiment', // owner: #team-replay multivariate=control,test (gate on === 'test')
REPLAY_TRIGGERS_V2: 'replay-triggers-v2', // owner: #team-replay
REPLAY_UI_REDESIGN_2026: 'replay-ui-redesign-2026', // owner: #team-replay, New UI layout for replay
REPLAY_VISION_ANALYSIS_NUDGE: 'replay-vision-analysis-nudge', // owner: #team-replay, in-player nudge offering an AI-drafted scanner after analyzing several recordings
diff --git a/frontend/src/scenes/scenes.ts b/frontend/src/scenes/scenes.ts
index 8d35a17cc156..63e5a150e5a1 100644
--- a/frontend/src/scenes/scenes.ts
+++ b/frontend/src/scenes/scenes.ts
@@ -727,6 +727,8 @@ export const redirects: Record<
'/replay': urls.replay(),
'/replay/recent': (_params, searchParams) =>
urls.replay(undefined, searchParams.filters, searchParams.sessionRecordingId),
+ '/replay/templates': (_params, searchParams, hashParams) =>
+ combineUrl(urls.replay(), { ...searchParams, showFilters: true, filtersTab: 'templates' }, hashParams).url,
'/saved_insights': urls.savedInsights(),
'/settings': urls.settings(),
'/settings/organization-rbac': urls.settings('organization-roles'),
diff --git a/frontend/src/scenes/session-recordings/SessionRecordings.tsx b/frontend/src/scenes/session-recordings/SessionRecordings.tsx
index aa650466c03a..0e62f377232f 100644
--- a/frontend/src/scenes/session-recordings/SessionRecordings.tsx
+++ b/frontend/src/scenes/session-recordings/SessionRecordings.tsx
@@ -4,7 +4,7 @@ import posthog from 'posthog-js'
import { useState } from 'react'
import { IconDocument, IconGear, IconHeadset } from '@posthog/icons'
-import { LemonBadge, LemonButton, Link } from '@posthog/lemon-ui'
+import { LemonButton, Link } from '@posthog/lemon-ui'
import { PostHogCaptureOnViewed } from '@posthog/react'
import { isAccessDeniedError, shouldReportApiFailure } from 'lib/api-error'
@@ -31,12 +31,10 @@ import { ScenePanel, ScenePanelActionsSection } from '~/layout/scenes/SceneLayou
import { ProductKey } from '~/queries/schema/schema-general'
import { AccessControlLevel, AccessControlResourceType, ReplayTab, ReplayTabs } from '~/types'
-import { ReplayComments } from 'products/replay/frontend/comments/ReplayComments'
import { sessionReplayEmptyState } from 'products/replay/frontend/emptyState/sessionReplayEmptyState'
import { SessionRecordingCollections } from './collections/SessionRecordingCollections'
import { SessionRecordingsPlaylistRedesign } from './playlist-redesign/SessionRecordingsPlaylistRedesign'
-import { playlistFiltersLogic } from './playlist/playlistFiltersLogic'
import { createPlaylist } from './playlist/playlistUtils'
import { SessionRecordingsPlaylist } from './playlist/SessionRecordingsPlaylist'
import {
@@ -45,7 +43,6 @@ import {
} from './playlist/sessionRecordingsPlaylistLogic'
import { sessionRecordingEventUsageLogic } from './sessionRecordingEventUsageLogic'
import { sessionReplaySceneLogic } from './sessionReplaySceneLogic'
-import SessionRecordingTemplates from './templates/SessionRecordingTemplates'
function Header(): JSX.Element {
const { tab } = useValues(sessionReplaySceneLogic)
@@ -208,10 +205,6 @@ function MainPanel(): JSX.Element {
</div>
) : tab === ReplayTabs.Playlists ? (
<SessionRecordingCollections />
- ) : tab === ReplayTabs.Comments ? (
- <ReplayComments />
- ) : tab === ReplayTabs.Templates ? (
- <SessionRecordingTemplates />
) : null}
</div>
)
@@ -231,41 +224,19 @@ const ReplayPageTabs: ReplayTab[] = [
tooltip: 'View & create collections',
'data-attr': 'session-recordings-collections-tab',
},
- {
- label: 'Comments',
- key: ReplayTabs.Comments,
- tooltip: 'Comments you added to recordings',
- 'data-attr': 'session-recordings-comments-tab',
- },
- {
- label: 'Filter templates',
- key: ReplayTabs.Templates,
- 'data-attr': 'session-recordings-templates-tab',
- },
]
export function SessionRecordingsPageTabs(): JSX.Element {
- const { tab, shouldShowNewBadge } = useValues(sessionReplaySceneLogic)
- const { templatesInFiltersPanel } = useValues(playlistFiltersLogic)
- const visibleTabs = templatesInFiltersPanel
- ? ReplayPageTabs.filter((replayTab) => replayTab.key !== ReplayTabs.Templates)
- : ReplayPageTabs
+ const { tab } = useValues(sessionReplaySceneLogic)
return (
<LemonTabs
activeKey={tab}
onChange={(t) => router.actions.push(urls.replay(t as ReplayTabs))}
sceneInset
className="-mt-4"
- tabs={visibleTabs.map((replayTab): LemonTab<string> => {
+ tabs={ReplayPageTabs.map((replayTab): LemonTab<string> => {
return {
- label: (
- <>
- {replayTab.label}
- {replayTab.label === ReplayTabs.Templates && shouldShowNewBadge && (
- <LemonBadge className="ml-1" size="small" />
- )}
- </>
- ),
+ label: replayTab.label,
key: replayTab.key,
link: urls.replay(replayTab.key),
tooltip: replayTab.tooltip,
diff --git a/frontend/src/scenes/session-recordings/filters/RecordingsUniversalFiltersEmbed.stories.tsx b/frontend/src/scenes/session-recordings/filters/RecordingsUniversalFiltersEmbed.stories.tsx
index fc89dba39978..86a3bea53152 100644
--- a/frontend/src/scenes/session-recordings/filters/RecordingsUniversalFiltersEmbed.stories.tsx
+++ b/frontend/src/scenes/session-recordings/filters/RecordingsUniversalFiltersEmbed.stories.tsx
@@ -138,7 +138,6 @@ export const EventMatchScopeOnlyDuringRecording: Story = {
export const TemplatesTab: Story = {
parameters: {
- featureFlags: { [FEATURE_FLAGS.REPLAY_TEMPLATES_IN_FILTERS_PANEL_EXPERIMENT]: 'test' },
pageUrl: combineUrl(urls.replay(), { showFilters: true, filtersTab: 'templates' }).url,
},
}
diff --git a/frontend/src/scenes/session-recordings/filters/RecordingsUniversalFiltersEmbed.tsx b/frontend/src/scenes/session-recordings/filters/RecordingsUniversalFiltersEmbed.tsx
index ce7d7da015f7..9150081ed3b1 100644
--- a/frontend/src/scenes/session-recordings/filters/RecordingsUniversalFiltersEmbed.tsx
+++ b/frontend/src/scenes/session-recordings/filters/RecordingsUniversalFiltersEmbed.tsx
@@ -335,7 +335,7 @@ export const RecordingsUniversalFiltersEmbed = ({ ...props }: ReplayUniversalFil
useMountedLogic(actionsModel)
useMountedLogic(groupsModel)
- const { activeFilterTab, templatesInFiltersPanel } = useValues(playlistFiltersLogic)
+ const { activeFilterTab } = useValues(playlistFiltersLogic)
const { setIsFiltersExpanded, setActiveFilterTab } = useActions(playlistFiltersLogic)
const { savedFilters } = useValues(sessionRecordingSavedFiltersLogic)
@@ -362,26 +362,22 @@ export const RecordingsUniversalFiltersEmbed = ({ ...props }: ReplayUniversalFil
content: <SavedFilters setFilters={props.setFilters} />,
'data-attr': 'session-recordings-saved-tab',
},
- ...(templatesInFiltersPanel
- ? [
- {
- key: 'templates',
- label: <div className="px-2">Templates</div>,
- content: (
- <div className="p-2">
- <FilterTemplates
- source="filters_panel"
- onApply={(filters) => {
- props.setFilters(filters)
- setActiveFilterTab('filters')
- }}
- />
- </div>
- ),
- 'data-attr': 'session-recordings-templates-tab',
- },
- ]
- : []),
+ {
+ key: 'templates',
+ label: <div className="px-2">Templates</div>,
+ content: (
+ <div className="p-2">
+ <FilterTemplates
+ source="filters_panel"
+ onApply={(filters) => {
+ props.setFilters(filters)
+ setActiveFilterTab('filters')
+ }}
+ />
+ </div>
+ ),
+ 'data-attr': 'session-recordings-templates-tab',
+ },
]
return (
diff --git a/frontend/src/scenes/session-recordings/playlist/playlistFiltersLogic.ts b/frontend/src/scenes/session-recordings/playlist/playlistFiltersLogic.ts
index c1b07a2e5e5c..4058efcc282c 100644
--- a/frontend/src/scenes/session-recordings/playlist/playlistFiltersLogic.ts
+++ b/frontend/src/scenes/session-recordings/playlist/playlistFiltersLogic.ts
@@ -1,20 +1,16 @@
-import { MakeLogicType, actions, connect, kea, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers } from 'kea'
import { actionToUrl, router, urlToAction } from 'kea-router'
-import { FEATURE_FLAGS } from 'lib/constants'
-import { FeatureFlagsSet, featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { urls } from 'scenes/urls'
import { ReplayTabs } from '~/types'
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface playlistFiltersLogicValues {
- featureFlags: FeatureFlagsSet // featureFlagLogic
activeCategory: string
activeFilterTab: string
isExpanded: boolean
isFiltersExpanded: boolean
- templatesInFiltersPanel: boolean
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
@@ -33,25 +29,10 @@ export interface playlistFiltersLogicActions {
}
}
-// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface playlistFiltersLogicMeta {
- __keaTypeGenInternalSelectorTypes: {
- templatesInFiltersPanel: (featureFlags: FeatureFlagsSet) => boolean
- }
-}
-
-export type playlistFiltersLogicType = MakeLogicType<
- playlistFiltersLogicValues,
- playlistFiltersLogicActions,
- Record<string, any>,
- playlistFiltersLogicMeta
->
+export type playlistFiltersLogicType = MakeLogicType<playlistFiltersLogicValues, playlistFiltersLogicActions>
export const playlistFiltersLogic = kea<playlistFiltersLogicType>([
path(['scenes', 'session-recordings', 'playlist', 'playlistFiltersLogic']),
- connect(() => ({
- values: [featureFlagLogic, ['featureFlags']],
- })),
actions({
setIsExpanded: (isExpanded: boolean) => ({ isExpanded }), // WIll be removed together with Mix (R.I.P. Mix)
setIsFiltersExpanded: (isFiltersExpanded: boolean) => ({ isFiltersExpanded }),
@@ -84,13 +65,6 @@ export const playlistFiltersLogic = kea<playlistFiltersLogicType>([
},
],
}),
- selectors({
- templatesInFiltersPanel: [
- (s) => [s.featureFlags],
- (featureFlags: FeatureFlagsSet) =>
- featureFlags[FEATURE_FLAGS.REPLAY_TEMPLATES_IN_FILTERS_PANEL_EXPERIMENT] === 'test',
- ],
- }),
urlToAction(({ actions }) => ({
[urls.replay(ReplayTabs.Home)]: (_, searchParams) => {
if (searchParams.filtersTab && ['filters', 'saved', 'templates'].includes(searchParams.filtersTab)) {
diff --git a/frontend/src/scenes/session-recordings/sessionReplaySceneLogic.ts b/frontend/src/scenes/session-recordings/sessionReplaySceneLogic.ts
index f92e894ba223..99cbdd62f326 100644
--- a/frontend/src/scenes/session-recordings/sessionReplaySceneLogic.ts
+++ b/frontend/src/scenes/session-recordings/sessionReplaySceneLogic.ts
@@ -1,7 +1,6 @@
-import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
-import { combineUrl, router, urlToAction } from 'kea-router'
+import { MakeLogicType, actions, kea, path, reducers, selectors } from 'kea'
+import { router, urlToAction } from 'kea-router'
-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { trackedActionToUrl } from 'lib/logic/scenes/trackedActionToUrl'
import { capitalizeFirstLetter } from 'lib/utils/strings'
import { sceneConfigurations } from 'scenes/scenes'
@@ -11,18 +10,12 @@ import { urls } from 'scenes/urls'
import { SIDE_PANEL_CONTEXT_KEY, SidePanelSceneContext } from '~/layout/navigation-3000/sidepanel/types'
import { ActivityScope, Breadcrumb, ReplayTabs } from '~/types'
-import { playlistFiltersLogic } from './playlist/playlistFiltersLogic'
-
export const humanFriendlyTabName = (tab: ReplayTabs): string => {
switch (tab) {
case ReplayTabs.Home:
return 'Recordings'
case ReplayTabs.Playlists:
return 'Collections'
- case ReplayTabs.Comments:
- return 'Comments'
- case ReplayTabs.Templates:
- return 'Filter templates'
case ReplayTabs.Settings:
return 'Settings'
default:
@@ -32,18 +25,13 @@ export const humanFriendlyTabName = (tab: ReplayTabs): string => {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface sessionReplaySceneLogicValues {
- templatesInFiltersPanel: boolean // playlistFiltersLogic
breadcrumbs: Breadcrumb[]
- shouldShowNewBadge: boolean
sidePanelContext: SidePanelSceneContext
tab: ReplayTabs
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface sessionReplaySceneLogicActions {
- hideNewBadge: () => {
- value: true
- }
setTab: (tab?: ReplayTabs) => {
tab: ReplayTabs
}
@@ -64,21 +52,10 @@ export type sessionReplaySceneLogicType = MakeLogicType<
sessionReplaySceneLogicMeta
>
-const templatesInPanelUrl = (): string =>
- combineUrl(
- urls.replay(ReplayTabs.Home),
- { ...router.values.searchParams, showFilters: true, filtersTab: 'templates' },
- router.values.hashParams
- ).url
-
export const sessionReplaySceneLogic = kea<sessionReplaySceneLogicType>([
path(() => ['scenes', 'session-recordings', 'sessionReplaySceneLogic']),
- connect(() => ({
- values: [playlistFiltersLogic, ['templatesInFiltersPanel']],
- })),
actions({
setTab: (tab: ReplayTabs = ReplayTabs.Home) => ({ tab }),
- hideNewBadge: true,
}),
reducers(() => ({
tab: [
@@ -87,26 +64,6 @@ export const sessionReplaySceneLogic = kea<sessionReplaySceneLogicType>([
setTab: (_, { tab }) => tab,
},
],
- shouldShowNewBadge: [
- true as boolean,
- { persist: true },
- {
- hideNewBadge: () => false,
- },
- ],
- })),
-
- listeners(({ actions, values }) => ({
- setTab: ({ tab }) => {
- if (tab === ReplayTabs.Templates) {
- actions.hideNewBadge()
- }
- },
- [featureFlagLogic.actionTypes.setFeatureFlags]: () => {
- if (values.tab === ReplayTabs.Templates && values.templatesInFiltersPanel) {
- router.actions.replace(templatesInPanelUrl())
- }
- },
})),
trackedActionToUrl(({ values }) => {
@@ -159,10 +116,6 @@ export const sessionReplaySceneLogic = kea<sessionReplaySceneLogicType>([
// so, we're extra careful that the value being set is a valid tab
const candidateTab = tab as ReplayTabs
const validTab = Object.values(ReplayTabs).includes(candidateTab) ? candidateTab : ReplayTabs.Home
- if (validTab === ReplayTabs.Templates && values.templatesInFiltersPanel) {
- router.actions.replace(templatesInPanelUrl())
- return
- }
if (validTab !== values.tab) {
actions.setTab(validTab)
}
diff --git a/frontend/src/scenes/session-recordings/templates/SessionRecordingTemplates.tsx b/frontend/src/scenes/session-recordings/templates/SessionRecordingTemplates.tsx
deleted file mode 100644
index e2caef0d14b8..000000000000
--- a/frontend/src/scenes/session-recordings/templates/SessionRecordingTemplates.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import { router } from 'kea-router'
-
-import { urls } from 'scenes/urls'
-
-import { ReplayTabs } from '~/types'
-
-import { FilterTemplates } from './FilterTemplates'
-
-const SessionRecordingTemplates = (): JSX.Element => {
- return (
- <div className="flex flex-col gap-4">
- <p className="mb-0">
- Use a template to find a focus area, then watch the filtered replays to see where users struggle and
- what could be made more clear.
- </p>
- <FilterTemplates
- source="templates_tab"
- onApply={({ order, ...filters }) =>
- router.actions.push(urls.replay(ReplayTabs.Home, filters, undefined, order))
- }
- />
- </div>
- )
-}
-
-export default SessionRecordingTemplates
diff --git a/frontend/src/scenes/session-recordings/templates/sessionRecordingTemplatesLogic.tsx b/frontend/src/scenes/session-recordings/templates/sessionRecordingTemplatesLogic.tsx
index c2c44aa4918f..910c142f921f 100644
--- a/frontend/src/scenes/session-recordings/templates/sessionRecordingTemplatesLogic.tsx
+++ b/frontend/src/scenes/session-recordings/templates/sessionRecordingTemplatesLogic.tsx
@@ -49,7 +49,7 @@ const getPageviewFilterValue = (pageview: string): UniversalFiltersGroupValue =>
}
}
-export type ReplayTemplateUsedSource = 'templates_tab' | 'filters_panel'
+export type ReplayTemplateUsedSource = 'filters_panel'
export interface ReplayTemplateLogicPropsType {
template: ReplayTemplateType
@@ -110,7 +110,7 @@ export interface sessionReplayTemplatesLogicActions {
value: true
}
reportTemplateUsed: (source: ReplayTemplateUsedSource) => {
- source: ReplayTemplateUsedSource
+ source: 'filters_panel'
}
resetVariable: (variable: ReplayTemplateVariableType) => {
variable: ReplayTemplateVariableType
diff --git a/frontend/src/types.ts b/frontend/src/types.ts
index 47094cd5fbc4..f1fd838a4752 100644
--- a/frontend/src/types.ts
+++ b/frontend/src/types.ts
@@ -1127,8 +1127,6 @@ export enum SavedInsightsTabs {
export enum ReplayTabs {
Home = 'home',
Playlists = 'playlists',
- Comments = 'comments',
- Templates = 'templates',
Settings = 'settings',
}
diff --git a/products/replay/frontend/comments/ReplayComments.stories.tsx b/products/replay/frontend/comments/ReplayComments.stories.tsx
deleted file mode 100644
index 22ba31a55191..000000000000
--- a/products/replay/frontend/comments/ReplayComments.stories.tsx
+++ /dev/null
@@ -1,64 +0,0 @@
-import { Meta, StoryObj } from '@storybook/react'
-
-import { App } from 'scenes/App'
-import { recordings } from 'scenes/session-recordings/__mocks__/recordings'
-import { urls } from 'scenes/urls'
-
-import { mswDecorator } from '~/mocks/browser'
-import { ReplayTabs } from '~/types'
-
-const comment = (id: string, secondsIntoRecording: number, content: string): Record<string, any> => ({
- id,
- content,
- rich_content: null,
- version: 0,
- created_at: '2023-01-31T16:20:00Z',
- created_by: null,
- scope: 'Replay',
- item_id: `recording-${id}`,
- item_context: {
- time_in_recording: '2023-01-31T16:00:00Z',
- milliseconds_into_recording: secondsIntoRecording * 1000,
- },
- is_task: false,
- completed_at: null,
- completed_by: null,
- slack_thread: null,
-})
-
-// The scene replaces every tab with the session replay product empty state until its setup probe
-// finds a recording, so the recordings list has to answer before any of this tab is on screen.
-const sceneMocks = (comments: Record<string, any>[]): ReturnType<typeof mswDecorator> =>
- mswDecorator({
- get: {
- '/api/environments/:team_id/session_recordings': { has_next: false, results: recordings },
- '/api/projects/:team_id/comments/': { next: null, previous: null, results: comments },
- },
- })
-
-const meta: Meta = {
- component: App,
- title: 'Replay/Tabs/Comments',
- parameters: {
- layout: 'fullscreen',
- viewMode: 'story',
- mockDate: '2023-02-01',
- pageUrl: urls.replay(ReplayTabs.Comments),
- },
-}
-export default meta
-
-type Story = StoryObj<{}>
-
-export const ReplayComments: Story = {
- decorators: [
- sceneMocks([
- comment('1', 72, 'The checkout button does nothing on the first click.'),
- comment('2', 605, 'This user could not find the export option.'),
- ]),
- ],
-}
-
-export const ReplayCommentsEmpty: Story = {
- decorators: [sceneMocks([])],
-}
diff --git a/products/replay/frontend/comments/ReplayComments.tsx b/products/replay/frontend/comments/ReplayComments.tsx
deleted file mode 100644
index a57bfc72872b..000000000000
--- a/products/replay/frontend/comments/ReplayComments.tsx
+++ /dev/null
@@ -1,108 +0,0 @@
-import { useActions, useValues } from 'kea'
-
-import { IconEye } from '@posthog/icons'
-import { LemonButton, LemonTag } from '@posthog/lemon-ui'
-
-import { TZLabel } from 'lib/components/TZLabel'
-import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
-import { LemonTable, LemonTableColumns } from 'lib/lemon-ui/LemonTable'
-
-import { ReplayCommentRow, replayCommentsLogic } from './replayCommentsLogic'
-
-const columns: LemonTableColumns<ReplayCommentRow> = [
- {
- title: 'Comment',
- key: 'text',
- render: function Render(_, row) {
- return (
- <div className="flex flex-col gap-1 py-1">
- <div className="ph-no-capture whitespace-pre-wrap break-words">{row.text}</div>
- {row.isTask ? (
- <div>
- <LemonTag size="small" type={row.isCompleted ? 'success' : 'warning'}>
- {row.isCompleted ? 'Completed' : 'Task'}
- </LemonTag>
- </div>
- ) : null}
- </div>
- )
- },
- },
- {
- title: 'Recording',
- key: 'recording',
- width: 0,
- render: function Render(_, row) {
- if (!row.recordingUrl) {
- return null
- }
- return (
- <LemonButton
- to={row.recordingUrl}
- icon={<IconEye />}
- size="small"
- type="tertiary"
- tooltip="View in recording"
- data-attr="replay-comments-view-recording"
- >
- {row.timeInRecording ?? 'Watch'}
- </LemonButton>
- )
- },
- },
- {
- title: 'Commented',
- key: 'createdAt',
- width: 0,
- render: function Render(_, row) {
- return <TZLabel time={row.createdAt} />
- },
- },
-]
-
-export function ReplayComments(): JSX.Element {
- const { commentRows, firstPageLoading, commentPageLoading, hasMoreComments, hasLoadError } =
- useValues(replayCommentsLogic)
- const { loadReplayComments, loadMoreReplayComments } = useActions(replayCommentsLogic)
-
- if (hasLoadError) {
- return (
- <LemonBanner
- type="error"
- action={{
- children: 'Try again',
- onClick: loadReplayComments,
- 'data-attr': 'replay-comments-retry',
- }}
- >
- Could not load your comments. Try again, and contact support if it keeps happening.
- </LemonBanner>
- )
- }
-
- return (
- <div className="flex flex-col gap-2">
- <LemonTable
- columns={columns}
- dataSource={commentRows}
- loading={firstPageLoading}
- rowKey="id"
- nouns={['comment', 'comments']}
- emptyState="You have not commented on a recording yet. Open a recording and add a comment to see it here."
- />
- {hasMoreComments ? (
- <div className="flex justify-center">
- <LemonButton
- type="secondary"
- size="small"
- onClick={loadMoreReplayComments}
- loading={commentPageLoading}
- data-attr="replay-comments-load-more"
- >
- Load more
- </LemonButton>
- </div>
- ) : null}
- </div>
- )
-}
diff --git a/products/replay/frontend/comments/replayCommentsLogic.test.ts b/products/replay/frontend/comments/replayCommentsLogic.test.ts
deleted file mode 100644
index 31785dc21a4e..000000000000
--- a/products/replay/frontend/comments/replayCommentsLogic.test.ts
+++ /dev/null
@@ -1,109 +0,0 @@
-import { expectLogic } from 'kea-test-utils'
-
-import { userLogic } from 'scenes/userLogic'
-
-import { useMocks } from '~/mocks/jest'
-import { initKeaTests } from '~/test/init'
-
-import { replayCommentsLogic } from './replayCommentsLogic'
-
-const comment = (id: string, overrides: Record<string, any> = {}): Record<string, any> => ({
- id,
- content: `comment ${id}`,
- rich_content: null,
- version: 0,
- created_at: '2024-05-01T10:00:00Z',
- created_by: null,
- scope: 'Replay',
- item_id: 'the-recording-id',
- item_context: { time_in_recording: '2024-05-01T09:00:12Z', milliseconds_into_recording: 72000 },
- is_task: false,
- completed_at: null,
- completed_by: null,
- slack_thread: null,
- ...overrides,
-})
-
-describe('replayCommentsLogic', () => {
- let logic: ReturnType<typeof replayCommentsLogic.build>
- let requestedUrls: string[]
- let responseStatus: number
-
- beforeEach(() => {
- requestedUrls = []
- responseStatus = 200
- useMocks({
- get: {
- '/api/projects/:team_id/comments/': ({ request }) => {
- requestedUrls.push(request.url)
- if (responseStatus !== 200) {
- return [responseStatus, { detail: 'nope' }]
- }
- const cursor = new URL(request.url).searchParams.get('cursor')
- if (cursor === 'page-2') {
- return [200, { next: null, previous: null, results: [comment('2')] }]
- }
- return [
- 200,
- {
- next: 'http://localhost/api/projects/997/comments/?cursor=page-2',
- previous: null,
- results: [comment('1')],
- },
- ]
- },
- },
- })
- initKeaTests()
- logic = replayCommentsLogic()
- })
-
- // The whole point of the tab: dropping either filter would show every team member's
- // comments from every product, not the person's own replay comments.
- it("asks only for the current user's replay comments", async () => {
- logic.mount()
- await expectLogic(logic).toFinishAllListeners()
-
- const params = new URL(requestedUrls[0]).searchParams
- expect(params.get('scope')).toEqual('Replay')
- expect(params.get('created_by')).toEqual(String(userLogic.values.user?.id))
- })
-
- it('links each comment to its moment in the recording', async () => {
- logic.mount()
- await expectLogic(logic).toFinishAllListeners()
-
- expect(logic.values.commentRows).toMatchObject([
- {
- id: '1',
- text: 'comment 1',
- timeInRecording: '01:12',
- recordingUrl: expect.stringContaining('/replay/the-recording-id?timestamp='),
- },
- ])
- })
-
- it('appends the next page instead of replacing the loaded one', async () => {
- logic.mount()
- await expectLogic(logic).toFinishAllListeners()
- expect(logic.values.hasMoreComments).toBe(true)
-
- logic.actions.loadMoreReplayComments()
- await expectLogic(logic).toFinishAllListeners()
-
- expect(logic.values.commentRows.map((row) => row.id)).toEqual(['1', '2'])
- expect(logic.values.hasMoreComments).toBe(false)
- expect(new URL(requestedUrls[1]).searchParams.get('cursor')).toEqual('page-2')
- })
-
- // A failed load leaves no rows, so without this flag the tab would tell the person
- // they have never commented.
- it('reports a failed load instead of reading as an empty list', async () => {
- responseStatus = 500
- logic.mount()
- await expectLogic(logic).toFinishAllListeners()
-
- expect(logic.values.hasLoadError).toBe(true)
- expect(logic.values.firstPageLoading).toBe(false)
- })
-})
diff --git a/products/replay/frontend/comments/replayCommentsLogic.ts b/products/replay/frontend/comments/replayCommentsLogic.ts
deleted file mode 100644
index 27a9d45892c6..000000000000
--- a/products/replay/frontend/comments/replayCommentsLogic.ts
+++ /dev/null
@@ -1,221 +0,0 @@
-import { MakeLogicType, actions, afterMount, connect, kea, path, reducers, selectors } from 'kea'
-import { loaders } from 'kea-loaders'
-
-import { getCommentText, getRecordingLinkInfo } from 'lib/components/Comments/commentUtils'
-import { JSONContent } from 'lib/components/RichContentEditor/types'
-import { colonDelimitedDuration } from 'lib/utils/durations'
-import { getCurrentTeamId } from 'lib/utils/getAppContext'
-import { userLogic } from 'scenes/userLogic'
-
-import { ActivityScope, UserType } from '~/types'
-
-import { commentsList } from 'products/platform_features/frontend/generated/api'
-import type { CommentApi } from 'products/platform_features/frontend/generated/api.schemas'
-
-type ReplayCommentContext = {
- time_in_recording?: string
- milliseconds_into_recording?: number
-}
-
-export type ReplayCommentRow = {
- id: string
- text: string
- createdAt: string
- recordingUrl: string | null
- /** Position in the recording as `mm:ss`, or null for a comment with no player position. */
- timeInRecording: string | null
- isTask: boolean
- isCompleted: boolean
-}
-
-export type ReplayCommentPage = {
- comments: CommentApi[]
- nextCursor: string | null
-}
-
-/** The API returns the next page as a full URL; only its cursor is needed to ask for that page. */
-function cursorFromNextUrl(nextUrl: string | null | undefined): string | null {
- if (!nextUrl) {
- return null
- }
- try {
- return new URL(nextUrl, window.location.origin).searchParams.get('cursor')
- } catch {
- return null
- }
-}
-
-function toCommentRow(comment: CommentApi): ReplayCommentRow {
- // The comment serializer types both fields as free-form JSON, so the replay shape is asserted here
- const itemContext = (comment.item_context ?? null) as ReplayCommentContext | null
- const richContent = (comment.rich_content ?? null) as JSONContent | null
- const millisecondsIntoRecording = itemContext?.milliseconds_into_recording
-
- return {
- id: comment.id,
- text: getCommentText({ content: comment.content, rich_content: richContent }),
- createdAt: comment.created_at,
- recordingUrl:
- getRecordingLinkInfo({
- scope: comment.scope ?? '',
- item_id: comment.item_id,
- item_context: itemContext,
- })?.url ?? null,
- timeInRecording:
- millisecondsIntoRecording === undefined
- ? null
- : colonDelimitedDuration(millisecondsIntoRecording / 1000, null),
- isTask: !!comment.is_task,
- isCompleted: !!comment.completed_at,
- }
-}
-
-// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface replayCommentsLogicValues {
- user: UserType | null // userLogic
- commentPage: ReplayCommentPage | null
- commentPageLoading: boolean
- commentRows: ReplayCommentRow[]
- firstPageLoading: boolean
- hasLoadError: boolean
- hasMoreComments: boolean
-}
-
-// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface replayCommentsLogicActions {
- loadMoreReplayComments: () => {
- value: true
- }
- loadMoreReplayCommentsFailure: (
- error: string,
- errorObject?: any
- ) => {
- error: string
- errorObject?: any
- }
- loadMoreReplayCommentsSuccess: (
- commentPage: ReplayCommentPage | null,
- payload?: {
- value: true
- }
- ) => {
- commentPage: ReplayCommentPage | null
- payload?: {
- value: true
- }
- }
- loadReplayComments: () => {
- value: true
- }
- loadReplayCommentsFailure: (
- error: string,
- errorObject?: any
- ) => {
- error: string
- errorObject?: any
- }
- loadReplayCommentsSuccess: (
- commentPage: ReplayCommentPage | null,
- payload?: {
- value: true
- }
- ) => {
- commentPage: ReplayCommentPage | null
- payload?: {
- value: true
- }
- }
-}
-
-// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface replayCommentsLogicMeta {
- __keaTypeGenInternalSelectorTypes: {
- commentRows: (commentPage: ReplayCommentPage | null) => ReplayCommentRow[]
- hasMoreComments: (commentPage: ReplayCommentPage | null) => boolean
- firstPageLoading: (commentPageLoading: boolean, commentPage: ReplayCommentPage | null) => boolean
- }
-}
-
-export type replayCommentsLogicType = MakeLogicType<
- replayCommentsLogicValues,
- replayCommentsLogicActions,
- Record<string, any>,
- replayCommentsLogicMeta
->
-
-export const replayCommentsLogic = kea<replayCommentsLogicType>([
- path(() => ['products', 'replay', 'comments', 'replayCommentsLogic']),
- connect(() => ({
- values: [userLogic, ['user']],
- })),
- actions({
- loadReplayComments: true,
- loadMoreReplayComments: true,
- }),
- loaders(({ values }) => ({
- commentPage: [
- null as ReplayCommentPage | null,
- {
- loadReplayComments: async (_, breakpoint): Promise<ReplayCommentPage | null> => {
- const userId = values.user?.id
- if (!userId) {
- return null
- }
- const response = await commentsList(String(getCurrentTeamId()), {
- scope: ActivityScope.REPLAY,
- created_by: userId,
- })
- breakpoint()
- return { comments: response.results, nextCursor: cursorFromNextUrl(response.next) }
- },
- loadMoreReplayComments: async (_, breakpoint): Promise<ReplayCommentPage | null> => {
- const userId = values.user?.id
- const cursor = values.commentPage?.nextCursor
- if (!userId || !cursor) {
- return values.commentPage
- }
- const response = await commentsList(String(getCurrentTeamId()), {
- scope: ActivityScope.REPLAY,
- created_by: userId,
- cursor,
- })
- breakpoint()
- return {
- comments: [...(values.commentPage?.comments ?? []), ...response.results],
- nextCursor: cursorFromNextUrl(response.next),
- }
- },
- },
- ],
- })),
- reducers({
- hasLoadError: [
- false,
- {
- loadReplayComments: () => false,
- loadReplayCommentsSuccess: () => false,
- loadReplayCommentsFailure: () => true,
- },
- ],
- }),
- selectors(() => ({
- commentRows: [
- (s) => [s.commentPage],
- (commentPage: ReplayCommentPage | null): ReplayCommentRow[] =>
- (commentPage?.comments ?? []).map(toCommentRow),
- ],
- hasMoreComments: [
- (s) => [s.commentPage],
- (commentPage: ReplayCommentPage | null): boolean => !!commentPage?.nextCursor,
- ],
- // Keeps the empty state off the screen until the first page has answered
- firstPageLoading: [
- (s) => [s.commentPageLoading, s.commentPage],
- (commentPageLoading: boolean, commentPage: ReplayCommentPage | null): boolean =>
- commentPageLoading && commentPage === null,
- ],
- })),
- afterMount(({ actions }) => {
- actions.loadReplayComments()
- }),
-])