:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(replay-vision): add grid view to What to watch feed (#109589)
Kim Svatos Dugan00d80b447bcb
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex d0169258513d..09a5631a422d 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -12027,15 +12027,19 @@ snapshots:scenes-app-replay-vision--classifier-overview--light:hash: v1.k794b7964.a525b3709b0055472e1bd08b449ac93000043f2a0928d233ecafa3e67424212e.t9hKH0qtjfg3qV6oucjjexNP2p1-F6KwzARZN0oWfrwscenes-app-replay-vision--home-watch-feed--dark:- hash: v1.k794b7964.a8eb64af8c0815f403c3bedad6f11cd7f185c6bf462c478bc582cc1082f967ed.n3NxrxJfzaMizJYH3YfEGqx2H74nv9OXq8nlIgNl95I+ hash: v1.k794b7964.4e49c04cab295c8244570e27b42dd6d08712914dfb46c071e8d58cf97e05ca22.j0LdxNaQxcSLZggc0YaC6ZMGaRSWCAHeIz8Pu4EN9e0scenes-app-replay-vision--home-watch-feed--light:- hash: v1.k794b7964.d891003a18f40fdfd7a5c7acb16fd69a7432917c0758c9d751ce9848e0e817a6.MU9DRlLvjCioaMuOgSbAL0Tfrcx9SNFVPVWgKfQ8pKc+ hash: v1.k794b7964.288fedc5c386d3f56e1a966bde1c7e23925aff3dfd14b9bd59f4850819561df3.QKxn0utvK9ZKjjQkKna85QywDjMVBeQXLvUPBvzJq54scenes-app-replay-vision--home-watch-feed-empty--dark:hash: v1.k794b7964.926bab41fb78cabf70493f52b629520842bcdb6fd7e0a838babb178ad948c67f.6Q9grGAgt0DLOh0YWKUgIOuHlFvn0gDCeHHOrqdav7gscenes-app-replay-vision--home-watch-feed-empty--light:hash: v1.k794b7964.71ae84e0d38203d5860ee8feb2a633a339e79de59b03b514807c7493517486fb.3NLgnN7g1YbjscaN_XzQhxSoqltm99utfh3_1E_29J8+ scenes-app-replay-vision--home-watch-feed-grid--dark:+ hash: v1.k794b7964.b6c0021cb654a1959c5f31038f0d0bfc677d02e14feee183cd6c4e116db5242b.z8lywqGVYD1SrmfpwUCvjNguFhzC69zsQh8dHfKnhGM+ scenes-app-replay-vision--home-watch-feed-grid--light:+ hash: v1.k794b7964.eef70399f888f57b020a2ec2df31807c2ab0fab72d763576aa997d792a869677.Q2y0D347yvVcCTX-e9lPPuFzqH1fcfpoXQqwc087OWkscenes-app-replay-vision--home-watch-feed-only-newest--dark:- hash: v1.k794b7964.f64a7c7bb16de8d589664ccb6e0bce38eba82a63d1375d348c3a44628445a98f.LWCEsvlNc28TTOiiwI7-GrLQm165fAPCjY3oBQWKVVs+ hash: v1.k794b7964.4bdb8bb02fdf4e1402f3187ef680ef0bf1081f23689307facdbbe83906c6077f.LfMy-ghDtnRl-yhFxu1Xc7L8o2ZVkHtnzxtov82AuZYscenes-app-replay-vision--home-watch-feed-only-newest--light:hash: v1.k794b7964.7a3c6205566a677d0d78d3c0e4c04c19aaaaad98857323c0ee4138d572a9b29c.hpcmZrUqq_ViM2kzyyACs4gqqfrIuEckqWWEH5fTWGUscenes-app-replay-vision--monitor-observations--dark:diff --git a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsxindex 323adecaa745..67ce48e6f3f6 100644--- a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx+++ b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx@@ -986,6 +986,22 @@ export const HomeWatchFeed: StoryObj = {},}+const WATCH_FEED_VIEW_STORAGE_KEY = 'products.replay_vision.frontend.replay_scanners.watchFeedLogic.view'++// The same feed as thumbnail cards, each closing with why the recording was picked.+export const HomeWatchFeedGrid: StoryObj = {+ parameters: {+ featureFlags: { [FEATURE_FLAGS.REPLAY_VISION_HOME_REDESIGN_EXPERIMENT]: 'test' },+ },+ // Seed the saved view before render instead of clicking the toggle: the snapshot build is production+ // React, which has no act(), so testing-library helpers fail there. Remove it afterwards, or every+ // later feed story renders as a grid too.+ beforeEach: () => {+ localStorage.setItem(WATCH_FEED_VIEW_STORAGE_KEY, JSON.stringify('grid'))+ return () => localStorage.removeItem(WATCH_FEED_VIEW_STORAGE_KEY)+ },+}+// A quiet window: nothing scored on any source, so the feed pads to three newest clips and says so// rather than filling the page with them.export const HomeWatchFeedOnlyNewest: StoryObj = {diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsx b/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsxindex bf481bfa8e87..1e45f82c4e14 100644--- a/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsx@@ -2,7 +2,7 @@ import { useActions } from 'kea'import { combineUrl, router } from 'kea-router'import { IconFlag, IconPlay, IconPlayFilled } from '@posthog/icons'-import { LemonButton, Link, Tooltip } from '@posthog/lemon-ui'+import { LemonButton, LemonCard, Link, Tooltip } from '@posthog/lemon-ui'import { TZLabel } from 'lib/components/TZLabel'import posthog from 'lib/posthog-typed'@@ -18,6 +18,7 @@ import type { ReplayObservationApi, WatchFeedItemApi, WatchFeedReasonApi } fromimport { OBSERVATION_ORIGIN_PARAM, WATCH_FEED_ORIGIN } from '../../utils/breadcrumbs'import { citedTextToPlainText } from '../../utils/citations'import { ScannerType } from '../types'+import type { WatchFeedView } from '../watchFeedLogic'const roundScore = (value: number): number => Math.round(value * 100) / 100@@ -202,8 +203,23 @@ interface WatchFeedCardProps {position: number}-export function WatchFeedCard({ item, position }: WatchFeedCardProps): JSX.Element {- const { observation, reason } = item+interface WatchFeedCardData {+ keyMomentMs: number | null+ scannerType: ScannerType | undefined+ scannerName: string+ person: string | null | undefined+ headline: ReturnType<typeof watchCardHeadline>+ observationUrl: string+ captureObservationOpened: () => void+ watchClipInModal: () => void+}++/** What both card layouts show and do, so the grid and the list open and report clips the same way. */+function useWatchFeedCardData(+ { observation, reason }: WatchFeedItemApi,+ position: number,+ view: WatchFeedView+): WatchFeedCardData {const { openSessionPlayer } = useActions(sessionPlayerModalLogic)const result = readResult(observation)// Fall back to the result's own scanner_type when the snapshot is absent, like watchCardHeadline,@@ -231,6 +247,7 @@ export function WatchFeedCard({ item, position }: WatchFeedCardProps): JSX.Elemereason_kind: reason.kind,has_key_moment: keyMomentMs !== null,target,+ view,})}const watchClipInModal = (): void => {@@ -247,6 +264,128 @@ export function WatchFeedCard({ item, position }: WatchFeedCardProps): JSX.Eleme)openSessionPlayer({ id: observation.session_id })}+ return {+ keyMomentMs,+ scannerType,+ scannerName,+ person,+ headline,+ observationUrl,+ captureObservationOpened: () => capture('observation'),+ watchClipInModal,+ }+}++function WatchClipPoster({+ observation,+ keyMomentMs,+ onWatch,+ className,+}: {+ observation: ReplayObservationApi+ keyMomentMs: number | null+ onWatch: () => void+ className?: string+}): JSX.Element {+ return (+ <button+ type="button"+ onClick={onWatch}+ className="relative z-10 block w-full cursor-pointer"+ data-attr="vision-watch-clip"+ aria-label="Watch clip"+ >+ <ObservationThumbnail observation={observation} className={className}>+ <span className="flex items-center gap-1.5 rounded-full bg-black/70 px-3 py-1 text-xs font-semibold text-white">+ <IconPlayFilled aria-hidden />+ Watch clip+ </span>+ </ObservationThumbnail>+ {keyMomentMs !== null && (+ <Tooltip title="Key moment: where the scan's answer rests most. The clip starts just before it.">+ <span className="absolute bottom-1 right-1 text-xs tabular-nums bg-bg-light border rounded px-1">+ {colonDelimitedDuration(Math.floor(keyMomentMs / 1000), null)}+ </span>+ </Tooltip>+ )}+ </button>+ )+}++function WatchCardPerson({+ observation,+ person,+}: {+ observation: ReplayObservationApi+ person: string | null | undefined+}): JSX.Element {+ return (+ <div className="flex flex-wrap items-center gap-1 text-xs text-muted">+ {person &&+ (observation.distinct_id ? (+ <Link+ to={urls.personByDistinctId(observation.distinct_id)}+ className="relative z-10 truncate min-w-0 text-muted"+ data-attr="vision-watch-feed-person"+ >+ {person}+ </Link>+ ) : (+ <span className="truncate min-w-0">{person}</span>+ ))}+ {person && <span aria-hidden>·</span>}+ <TZLabel time={observation.created_at} className="shrink-0" />+ </div>+ )+}++function WatchCardScanner({+ observation,+ scannerType,+ scannerName,+}: {+ observation: ReplayObservationApi+ scannerType: ScannerType | undefined+ scannerName: string+}): JSX.Element {+ return (+ // Above the overlay link so the outcome's hover tooltip stays reachable. The summarizer's+ // outcome is the title + body, so it adds no chip here.+ <div className="relative z-10 flex flex-wrap items-center gap-x-2 gap-y-1 min-w-0">+ {/* One text flow, so on a narrow card the question starts beside the badge and wraps under it+ instead of the whole question dropping to its own line. */}+ <p className="m-0 min-w-0 text-xs leading-5">+ {scannerType && (+ <span className="inline-flex align-middle mr-1.5">+ <ScannerTypeBadge scannerType={scannerType} />+ </span>+ )}+ {/* The question says what the result answers; the scanner's name is a hover away. */}+ {observation.prompt_question ? (+ <Tooltip title={scannerName}>+ <span>{observation.prompt_question}</span>+ </Tooltip>+ ) : (+ <span className="text-muted">{scannerName}</span>+ )}+ </p>+ {scannerType !== 'summarizer' && <ObservationResultSummary observation={observation} />}+ </div>+ )+}++export function WatchFeedCard({ item, position }: WatchFeedCardProps): JSX.Element {+ const { observation, reason } = item+ const {+ keyMomentMs,+ scannerType,+ scannerName,+ person,+ headline,+ observationUrl,+ captureObservationOpened,+ watchClipInModal,+ } = useWatchFeedCardData(item, position, 'list')return (<div@@ -257,27 +396,7 @@ export function WatchFeedCard({ item, position }: WatchFeedCardProps): JSX.Eleme{/* The thumbnail is the watch affordance, so the whole poster opens the clip modal.The New tag and the key moment sit outside the poster, which clips its own overflow. */}<div className="relative hidden @md:block w-64 shrink-0 self-start">- <button- type="button"- onClick={watchClipInModal}- className="relative z-10 block w-full cursor-pointer"- data-attr="vision-watch-clip"- aria-label="Watch clip"- >- <ObservationThumbnail observation={observation}>- <span className="flex items-center gap-1.5 rounded-full bg-black/70 px-3 py-1 text-xs font-semibold text-white">- <IconPlayFilled aria-hidden />- Watch clip- </span>- </ObservationThumbnail>- {keyMomentMs !== null && (- <Tooltip title="Key moment: where the scan's answer rests most. The clip starts just before it.">- <span className="absolute bottom-1 right-1 text-xs tabular-nums bg-bg-light border rounded px-1">- {colonDelimitedDuration(Math.floor(keyMomentMs / 1000), null)}- </span>- </Tooltip>- )}- </button>+ <WatchClipPoster observation={observation} keyMomentMs={keyMomentMs} onWatch={watchClipInModal} />{/* Sits above the button, so it lets clicks through to open the clip. */}{!observation.viewed && (<UnviewedObservationTag className="absolute top-1 left-1 z-10 pointer-events-none" />@@ -289,7 +408,7 @@ export function WatchFeedCard({ item, position }: WatchFeedCardProps): JSX.Eleme`relative z-10`, so the anchors never nest. */}<Linkto={observationUrl}- onClick={() => capture('observation')}+ onClick={captureObservationOpened}className="text-default after:absolute after:inset-0 after:content-['']"data-attr="vision-watch-feed-card-body">@@ -299,36 +418,8 @@ export function WatchFeedCard({ item, position }: WatchFeedCardProps): JSX.Eleme{headline?.title ?? scannerName}</h3></Link>- <div className="flex flex-wrap items-center gap-1 text-xs text-muted">- {person &&- (observation.distinct_id ? (- <Link- to={urls.personByDistinctId(observation.distinct_id)}- className="relative z-10 truncate min-w-0 text-muted"- data-attr="vision-watch-feed-person"- >- {person}- </Link>- ) : (- <span className="truncate min-w-0">{person}</span>- ))}- {person && <span aria-hidden>·</span>}- <TZLabel time={observation.created_at} className="shrink-0" />- </div>- {/* Above the overlay link so the outcome's hover tooltip stays reachable. The- summarizer's outcome is the title + body above, so it adds no chip here. */}- <div className="relative z-10 flex flex-wrap items-center gap-2 min-w-0">- {scannerType && <ScannerTypeBadge scannerType={scannerType} />}- {/* The question says what the result answers; the scanner's name is a hover away. */}- {observation.prompt_question ? (- <Tooltip title={scannerName}>- <span className="text-xs truncate">{observation.prompt_question}</span>- </Tooltip>- ) : (- <span className="text-muted text-xs truncate">{scannerName}</span>- )}- {scannerType !== 'summarizer' && <ObservationResultSummary observation={observation} />}- </div>+ <WatchCardPerson observation={observation} person={person} />+ <WatchCardScanner observation={observation} scannerType={scannerType} scannerName={scannerName} />{headline?.body && (<p className="text-muted text-xs m-0 line-clamp-2"><CitedText text={headline.body.text} segments={headline.body.segments} />@@ -353,3 +444,68 @@ export function WatchFeedCard({ item, position }: WatchFeedCardProps): JSX.Eleme</div>)}++/** The thumbnail-first layout for the grid view, with the feed's reason as its own closing section. */+export function WatchFeedGridCard({ item, position }: WatchFeedCardProps): JSX.Element {+ const { observation, reason } = item+ const {+ keyMomentMs,+ scannerType,+ scannerName,+ person,+ headline,+ observationUrl,+ captureObservationOpened,+ watchClipInModal,+ } = useWatchFeedCardData(item, position, 'grid')++ return (+ <LemonCard+ className="relative flex flex-col rounded-lg p-0 overflow-hidden hover:border-accent"+ data-attr="vision-watch-feed-grid-card"+ >+ {!observation.viewed && <span className="absolute inset-x-0 top-0 h-1 z-20 bg-accent" aria-hidden />}+ {/* The card clips its own corners and draws its own edge, so the poster goes edge to edge. */}+ <div className="relative">+ <WatchClipPoster+ observation={observation}+ keyMomentMs={keyMomentMs}+ onWatch={watchClipInModal}+ className="rounded-none border-0"+ />+ {!observation.viewed && (+ <UnviewedObservationTag className="absolute top-2 left-2 z-10 pointer-events-none" />+ )}+ </div>+ <div className="flex flex-col gap-1.5 p-3 min-w-0 flex-1">+ {/* Stretched over the card like the list card, so a click outside the poster and inner+ links opens the observation. */}+ <Link+ to={observationUrl}+ onClick={captureObservationOpened}+ className="text-default after:absolute after:inset-0 after:content-['']"+ data-attr="vision-watch-feed-card-body"+ >+ <h3 className="text-sm font-semibold m-0 line-clamp-2">+ {!observation.viewed && <span className="sr-only">New: </span>}+ {headline?.title ?? scannerName}+ </h3>+ </Link>+ <WatchCardPerson observation={observation} person={person} />+ <WatchCardScanner observation={observation} scannerType={scannerType} scannerName={scannerName} />+ {headline?.body && (+ <p className="text-muted text-xs m-0 line-clamp-2">+ <CitedText text={headline.body.text} segments={headline.body.segments} />+ </p>+ )}+ <div className="mt-auto flex flex-col gap-1 border-t pt-2" data-attr="vision-watch-feed-why">+ <span className="flex items-center gap-1.5 text-xs font-semibold text-muted">+ <IconFlag className="shrink-0 text-accent" aria-hidden />+ Why this recording+ </span>+ <span className="text-xs">{watchReasonCopy(reason)}</span>+ </div>+ </div>+ </LemonCard>+ )+}diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedTab.tsx b/products/replay_vision/frontend/replay_scanners/components/WatchFeedTab.tsxindex 3c897720b608..44a1fef68e91 100644--- a/products/replay_vision/frontend/replay_scanners/components/WatchFeedTab.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/WatchFeedTab.tsx@@ -1,7 +1,7 @@import { useActions, useValues } from 'kea'-import { IconSearch } from '@posthog/icons'-import { LemonButton, LemonInput, LemonSkeleton } from '@posthog/lemon-ui'+import { IconGridMasonry, IconList, IconSearch } from '@posthog/icons'+import { LemonButton, LemonInput, LemonSegmentedButton, LemonSkeleton } from '@posthog/lemon-ui'import { DateFilter } from 'lib/components/DateFilter/DateFilter'import { dateMapping } from 'lib/utils/dateFilters'@@ -10,8 +10,8 @@ import { pluralize } from 'lib/utils/strings'import { FilterPill } from '../../components/FilterPill'import { visionScannersListLogic } from '../../logics/visionScannersListLogic'import { SCANNER_TYPE_OPTIONS, ScannerType } from '../types'-import { watchFeedLogic } from '../watchFeedLogic'-import { FILLER_REASON_KINDS, WatchFeedCard } from './WatchFeedCard'+import { type WatchFeedView, watchFeedLogic } from '../watchFeedLogic'+import { FILLER_REASON_KINDS, WatchFeedCard, WatchFeedGridCard } from './WatchFeedCard'import { WatchFeedEmptyState } from './WatchFeedEmptyState'const TYPE_OPTIONS: { value: ScannerType; label: string }[] = SCANNER_TYPE_OPTIONS.map(({ value, label }) => ({@@ -31,6 +31,31 @@ const FEED_DATE_OPTION_KEYS = new Set([])const FEED_DATE_OPTIONS = dateMapping.filter((option) => FEED_DATE_OPTION_KEYS.has(option.key))+const GRID_CLASS_NAME = 'grid gap-3 grid-cols-1 @xl:grid-cols-2 @3xl:grid-cols-3'++function FeedSkeleton({ view }: { view: WatchFeedView }): JSX.Element {+ return view === 'grid' ? (+ <div className={GRID_CLASS_NAME} aria-busy>+ {[0, 1, 2].map((i) => (+ <div key={i} className="flex flex-col border rounded-lg overflow-hidden">+ <LemonSkeleton className="aspect-video w-full rounded-none" />+ <div className="flex flex-col gap-1.5 p-3">+ <LemonSkeleton className="h-4 w-2/3" />+ <LemonSkeleton className="h-3 w-full" />+ <LemonSkeleton className="h-3 w-1/2" />+ </div>+ </div>+ ))}+ </div>+ ) : (+ <div className="flex flex-col gap-3" aria-busy>+ {[0, 1, 2].map((i) => (+ <LemonSkeleton key={i} className="h-32 rounded" />+ ))}+ </div>+ )+}+export function WatchFeedTab(): JSX.Element {const {feedItems,@@ -45,6 +70,7 @@ export function WatchFeedTab(): JSX.Element {search,hasFeedFilters,emptyReason,+ view,} = useValues(watchFeedLogic)const {setDateRange,@@ -54,6 +80,7 @@ export function WatchFeedTab(): JSX.Element {setSearch,clearFeedFilters,loadFeed,+ setView,} = useActions(watchFeedLogic)const { scanners: allScanners } = useValues(visionScannersListLogic)const scannerOptions = allScanners.map((scanner) => ({@@ -70,7 +97,7 @@ export function WatchFeedTab(): JSX.Element {const onlyFiller = items.length > 0 && items.every((item) => FILLER_REASON_KINDS.has(item.reason.kind))return (- <div className="flex flex-col gap-4">+ <div className="@container flex flex-col gap-4"><div className="flex flex-wrap items-end justify-between gap-2"><div className="flex flex-col gap-1"><h2 className="text-xl font-semibold m-0">@@ -131,15 +158,30 @@ export function WatchFeedTab(): JSX.Element {Clear filters</LemonButton>)}+ <LemonSegmentedButton<WatchFeedView>+ size="xsmall"+ value={view}+ onChange={setView}+ options={[+ {+ value: 'grid',+ icon: <IconGridMasonry />,+ tooltip: 'Thumbnails',+ 'data-attr': 'vision-watch-feed-view-grid',+ },+ {+ value: 'list',+ icon: <IconList />,+ tooltip: 'List',+ 'data-attr': 'vision-watch-feed-view-list',+ },+ ]}+ /></div></div>{feedItemsLoading && feedItems === null ? (- <div className="flex flex-col gap-3">- {[0, 1, 2].map((i) => (- <LemonSkeleton key={i} className="h-32 rounded" />- ))}- </div>+ <FeedSkeleton view={view} />) : (<div className="flex flex-col gap-3">{/* kea-loaders keeps the last value on failure, so a later filter or date change can fail@@ -165,9 +207,17 @@ export function WatchFeedTab(): JSX.Element {</p>)}{items.length > 0 ? (- items.map((item, index) => (- <WatchFeedCard key={item.observation.id} item={item} position={index} />- ))+ view === 'grid' ? (+ <div className={GRID_CLASS_NAME}>+ {items.map((item, index) => (+ <WatchFeedGridCard key={item.observation.id} item={item} position={index} />+ ))}+ </div>+ ) : (+ items.map((item, index) => (+ <WatchFeedCard key={item.observation.id} item={item} position={index} />+ ))+ )) : feedFailed ? null : emptyReason ? (<WatchFeedEmptyState reason={emptyReason} />) : (diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.test.ts b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.test.tsindex c6af576ee5c1..6b88618c89ac 100644--- a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.test.ts+++ b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.test.ts@@ -127,6 +127,17 @@ describe('watchFeedLogic', () => {.toFinishAllListeners()})+ it('defaults to the list view and keeps the chosen view when filters clear', async () => {+ logic.mount()+ expect(logic.values.view).toBe('list')+ logic.actions.setView('grid')+ await expectLogic(logic, () => {+ logic.actions.clearFeedFilters()+ })+ .toMatchValues({ view: 'grid' })+ .toFinishAllListeners()+ })+it('names the empty reason only once the fleet and budget have answered', async () => {feedSpy.mockImplementation(() => [200, { results: [] }])useMocks({diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.tsindex 8838d0d18e1b..6c89174bf0a5 100644--- a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts+++ b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts@@ -44,6 +44,7 @@ export interface watchFeedLogicValues {value: string}[]tagsFilter: string[]+ view: WatchFeedView}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.@@ -103,6 +104,9 @@ export interface watchFeedLogicActions {setTagsFilter: (tags: string[]) => {tags: string[]}+ setView: (view: WatchFeedView) => {+ view: WatchFeedView+ }}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.@@ -140,6 +144,8 @@ export type watchFeedLogicType = MakeLogicType<export const DEFAULT_FEED_DATE_FROM: string = '-7d'+export type WatchFeedView = 'grid' | 'list'+function reportFiltered(values: watchFeedLogicValues): void {posthog.capture('replay_vision_watch_feed_filtered', {date_from: values.dateFrom,@@ -180,6 +186,7 @@ export const watchFeedLogic = kea<watchFeedLogicType>([restoreFeedFilters: (search: string, scannerIds: string[], tags: string[]) => ({ search, scannerIds, tags }),clearFeedFilters: true,loadFeed: true,+ setView: (view: WatchFeedView) => ({ view }),}),loaders(({ values }) => ({@@ -269,6 +276,14 @@ export const watchFeedLogic = kea<watchFeedLogicType>([clearFeedFilters: () => [],},],+ // A display choice, not a filter, so clearing filters leaves it alone.+ view: [+ 'list' as WatchFeedView,+ { persist: true },+ {+ setView: (_, { view }) => view,+ },+ ],feedFailed: [false,{@@ -309,6 +324,9 @@ export const watchFeedLogic = kea<watchFeedLogicType>([reportFiltered(values)actions.loadFeed()},+ setView: ({ view }) => {+ posthog.capture('replay_vision_watch_feed_view_changed', { view })+ },loadFeedSuccess: ({ feedItems }) => {const items = feedItems ?? []// The click event reports the reason a reader picked; without this one nothing reports the mix@@ -321,6 +339,7 @@ export const watchFeedLogic = kea<watchFeedLogicType>([clip_count: items.length,scanner_count: new Set(items.map((item) => item.observation.scanner_id)).size,reason_kind_counts: countByReasonKind,+ view: values.view,signal_share: items.length > 0 ? (countByReasonKind.signal_emitted ?? 0) / items.length : 0,// Which dead end the reader hit, so the empty screens can be counted and ranked// against each other instead of only showing up as a clip count of zero.