: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): flag expired recordings in search and add a date filter (#106265)
Kim Svatos Dugan9425b835151f
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex ba954c5d48ef..2250bf9ec75b 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -11172,6 +11172,14 @@ snapshots:hash: v1.k794b7964.d3c3aea7db95e55f3a3c6bd3266ed6a6c8a6b7d0c9639197be8499d52a311583.vcVaKjae7hHygKO4H_NDzkoa62WYvDIZvSa-Y-3DEr0scenes-app-replay-vision-observationthumbnail--no-frame-yet--light:hash: v1.k794b7964.7ea8bf86c6c2c46e8e19a7f65aeff30e4be8ea79e8159dc0ea9bc10baa4cd2c5.xt9_PBGwUPblnhPAtL-bcbSs_gQzXDfxAVB4vz8c63s+ scenes-app-replay-vision-recordingexpiredtag--compact--dark:+ hash: v1.k794b7964.97fde7ed79ff2f6a8df63aab3054a8951c1f8b8997390e8e3836c994d6071495.IFZQRiZ5TfL8tD2BARNFh8Lo54gl2xaQpQprxpxKRoQ+ scenes-app-replay-vision-recordingexpiredtag--compact--light:+ hash: v1.k794b7964.8f198d60b8e8f26d814173141288cfa6430d2c179c18467b7170f0346f4fd12d.gcwYBu6v34dOIbX-7bx8GMmUPn1DnIAcAgByvcMWDkg+ scenes-app-replay-vision-recordingexpiredtag--default--dark:+ hash: v1.k794b7964.27a90f028f594c371370fdc56b6ba14a427b34c27292e63f3c0a94e939e6a941.051i8LHCU3DaiN6kC_4gXIOwokLOxcjBVJ9zjcH-0HA+ scenes-app-replay-vision-recordingexpiredtag--default--light:+ hash: v1.k794b7964.dd4a7fd2ad97f5474ad762293c6fe59be57e93be64067e04a655e9443b8670d2.yotBh0ZOpK-CikDFoXSsLVMJdKw1WZJPq_2H6nO5hfgscenes-app-replay-vision-spendtrajectorychart--hits-the-limit--dark:hash: v1.k794b7964.cf96414912c6d8f0d73808db3f1d833c661d12b3b0449cdd49b95d4dc8059e80.3sA2mn18MksUWQQ4mq6wEPbkJhGP3O258Y6Q2fTWhgMscenes-app-replay-vision-spendtrajectorychart--hits-the-limit--light:diff --git a/products/replay_vision/frontend/components/RecordingExpiredTag.stories.tsx b/products/replay_vision/frontend/components/RecordingExpiredTag.stories.tsxnew file mode 100644index 000000000000..1b7b03d4deb3--- /dev/null+++ b/products/replay_vision/frontend/components/RecordingExpiredTag.stories.tsx@@ -0,0 +1,16 @@+import { Meta, StoryFn } from '@storybook/react'++import { RecordingExpiredTag } from './RecordingExpiredTag'++const meta: Meta<typeof RecordingExpiredTag> = {+ title: 'Scenes-App/Replay Vision/RecordingExpiredTag',+ component: RecordingExpiredTag,+}+export default meta++// The tag a search result shows once the recordings API confirms its recording no longer exists.+// Its tooltip copy appears on hover.+export const Default: StoryFn = () => <RecordingExpiredTag />++// The icon-only form the small list thumbnail uses; the tooltip still carries the full text.+export const Compact: StoryFn = () => <RecordingExpiredTag compact />diff --git a/products/replay_vision/frontend/components/RecordingExpiredTag.tsx b/products/replay_vision/frontend/components/RecordingExpiredTag.tsxnew file mode 100644index 000000000000..31577c03c09d--- /dev/null+++ b/products/replay_vision/frontend/components/RecordingExpiredTag.tsx@@ -0,0 +1,16 @@+import { IconClock } from '@posthog/icons'+import { LemonTag, Tooltip } from '@posthog/lemon-ui'++/**+ * Render only after the recordings API confirmed the observed session's recording no longer exists.+ * `compact` drops the label to the clock icon for the small list thumbnail; the tooltip keeps the text.+ */+export function RecordingExpiredTag({ compact = false }: { compact?: boolean }): JSX.Element {+ return (+ <Tooltip title="This recording was deleted when it passed its retention period. The analysis is still available, but the recording can no longer be played.">+ <LemonTag icon={<IconClock />} type="muted" size="small" data-attr="vision-recording-expired-tag">+ {!compact && 'Recording expired'}+ </LemonTag>+ </Tooltip>+ )+}diff --git a/products/replay_vision/frontend/search/ObservationSearch.tsx b/products/replay_vision/frontend/search/ObservationSearch.tsxindex 836e41893943..d91aa8643ab1 100644--- a/products/replay_vision/frontend/search/ObservationSearch.tsx+++ b/products/replay_vision/frontend/search/ObservationSearch.tsx@@ -8,6 +8,7 @@ import { IconChevronDown, IconClock, IconPlusSmall, IconSearch, IconSparkles, Icimport { LemonButton, LemonInput, LemonMenu, Popover, Spinner } from '@posthog/lemon-ui'import { pngHoggie } from 'lib/brand/hoggies'+import { DateFilter } from 'lib/components/DateFilter/DateFilter'import { aiConsentLogic } from 'scenes/settings/organization/aiConsentLogic'import { teamLogic } from 'scenes/teamLogic'import { urls } from 'scenes/urls'@@ -105,6 +106,8 @@ export function ObservationSearch({ className }: { className?: string }): JSX.Elconst {query,scannerId,+ dateFrom,+ dateTo,results,searching,searchedQuery,@@ -113,7 +116,7 @@ export function ObservationSearch({ className }: { className?: string }): JSX.ElsuggestedQueries,suggestedQueriesLoading,} = useValues(logic)- const { setQuery, setScannerId, search, clearSearch } = useActions(logic)+ const { setQuery, setScannerId, setDateRange, search, clearSearch } = useActions(logic)const [paletteOpen, setPaletteOpen] = useState(false)@@ -195,6 +198,16 @@ export function ObservationSearch({ className }: { className?: string }): JSX.El/>)}{/* The input chrome focuses the field on click, which opens the palette over the picker. */}+ <span onClick={(event) => event.stopPropagation()}>+ <DateFilter+ dateFrom={dateFrom}+ dateTo={dateTo}+ onChange={(fromDate, toDate) => setDateRange(fromDate, toDate)}+ size="small"+ type="secondary"+ placeholder="Any time"+ />+ </span><span onClick={(event) => event.stopPropagation()}><LemonMenu items={scopeItems} placement="bottom-end"><LemonButtondiff --git a/products/replay_vision/frontend/search/SearchResults.tsx b/products/replay_vision/frontend/search/SearchResults.tsxindex 86ea10c457ee..3afe3c903950 100644--- a/products/replay_vision/frontend/search/SearchResults.tsx+++ b/products/replay_vision/frontend/search/SearchResults.tsx@@ -13,6 +13,7 @@ import { urls } from 'scenes/urls'import { ObservationResultSummary } from '../components/ObservationCard'import { ObservationThumbnail } from '../components/ObservationThumbnail'+import { RecordingExpiredTag } from '../components/RecordingExpiredTag'import { ScannerOutputBadge } from '../components/ScannerOutputBadge'import { TimestampCitation } from '../components/TimestampCitation'import type { ObservationSearchResultApi, ReplayObservationApi } from '../generated/api.schemas'@@ -48,20 +49,26 @@ interface ResultProps {result: ObservationSearchResultApisearchedQuery: stringreturnParams: Record<string, string>+ /** True once the recordings API confirmed this result's recording no longer exists. */+ expired: boolean}-function WatchLink({ observation, compact }: { observation: ReplayObservationApi; compact?: boolean }): JSX.Element {+function WatchLink({+ observation,+ expired,+ compact,+}: {+ observation: ReplayObservationApi+ expired: boolean+ compact?: boolean+}): JSX.Element {const routerValues = useValues(router)const citedMs = firstCitedTimestampMs(observation)- return (- <Link- to={watchMomentUrl(observation, citedMs, routerValues)}- className={clsx('relative block text-primary group', compact && 'w-28')}- data-attr="vision-search-result-watch"- >- {/* The card clips its own corners and draws its own edge, so the poster goes edge to edge there. */}- <ObservationThumbnail observation={observation} className={clsx(!compact && 'rounded-none border-0')}>- {/* A fixed dark scrim, not a theme surface: the chip sits on a frame of any colour, white included. */}+ /* The card clips its own corners and draws its own edge, so the poster goes edge to edge there. */+ const thumbnail = (+ <ObservationThumbnail observation={observation} className={clsx(!compact && 'rounded-none border-0')}>+ {expired ? undefined : (+ /* A fixed dark scrim, not a theme surface: the chip sits on a frame of any colour, white included. */<spanclassName={clsx('rounded-full bg-black/60 text-white flex items-center justify-center group-hover:bg-black/80',@@ -70,7 +77,28 @@ function WatchLink({ observation, compact }: { observation: ReplayObservationApi><IconPlayFilled /></span>- </ObservationThumbnail>+ )}+ </ObservationThumbnail>+ )+ if (expired) {+ // Nothing to open, so no link. The tag sits on the frame where the watch caption would, which+ // keeps it off the result title.+ return (+ <span className={clsx('relative block', compact && 'w-28')}>+ {thumbnail}+ <span className={clsx('absolute', compact ? 'bottom-1 right-1' : 'bottom-2 right-2')}>+ <RecordingExpiredTag compact={compact} />+ </span>+ </span>+ )+ }+ return (+ <Link+ to={watchMomentUrl(observation, citedMs, routerValues)}+ className={clsx('relative block text-primary group', compact && 'w-28')}+ data-attr="vision-search-result-watch"+ >+ {thumbnail}{!compact && (<span className="absolute bottom-2 right-2 text-xs font-medium px-1.5 py-0.5 rounded bg-surface-primary border border-primary">{citedMs !== null@@ -151,13 +179,19 @@ function TopMatchTag(): JSX.Element {)}-function MomentCard({ result, searchedQuery, returnParams, tier }: ResultProps & { tier: Tier | null }): JSX.Element {+function MomentCard({+ result,+ searchedQuery,+ returnParams,+ expired,+ tier,+}: ResultProps & { tier: Tier | null }): JSX.Element {const observation = result.observationconst snapshot = observation.scanner_snapshotreturn (<LemonCard className="flex flex-col rounded-lg p-0 overflow-hidden" data-attr="vision-search-result"><div className="relative">- <WatchLink observation={observation} />+ <WatchLink observation={observation} expired={expired} /><span className="absolute top-2 left-2 flex items-center gap-1">{snapshot && <ScannerOutputBadge scannerType={snapshot.scanner_type} size="small" />}{tier === 'top' && <TopMatchTag />}@@ -187,13 +221,13 @@ function MomentCard({ result, searchedQuery, returnParams, tier }: ResultProps &)}-function MomentRow({ result, searchedQuery, returnParams }: ResultProps): JSX.Element {+function MomentRow({ result, searchedQuery, returnParams, expired }: ResultProps): JSX.Element {const observation = result.observationconst snapshot = observation.scanner_snapshotreturn (<LemonCard className="flex gap-3 rounded-lg p-2 min-w-0" data-attr="vision-search-result"><div className="shrink-0 self-center">- <WatchLink observation={observation} compact />+ <WatchLink observation={observation} expired={expired} compact /></div><div className="flex flex-col gap-1 min-w-0 flex-1"><div className="flex items-center gap-2 min-w-0">@@ -290,6 +324,7 @@ export function SearchResults(logicProps: ObservationSearchLogicProps): JSX.ElempageResults,pageStartIndex,pageEndIndex,+ expiredSessionIds,} = useValues(logic)const { setPage, setView } = useActions(logic)@@ -334,6 +369,7 @@ export function SearchResults(logicProps: ObservationSearchLogicProps): JSX.Elemresult={result}searchedQuery={searchedQuery ?? ''}returnParams={returnParams}+ expired={expiredSessionIds.has(result.observation.session_id)}tier={tierOf(result)}/>))}@@ -348,6 +384,7 @@ export function SearchResults(logicProps: ObservationSearchLogicProps): JSX.Elemresult={result}searchedQuery={searchedQuery ?? ''}returnParams={returnParams}+ expired={expiredSessionIds.has(result.observation.session_id)}/>))}</div>diff --git a/products/replay_vision/frontend/search/observationSearchLogic.test.ts b/products/replay_vision/frontend/search/observationSearchLogic.test.tsindex e8936ec45371..a41b91f8aee7 100644--- a/products/replay_vision/frontend/search/observationSearchLogic.test.ts+++ b/products/replay_vision/frontend/search/observationSearchLogic.test.ts@@ -77,6 +77,92 @@ describe('observationSearchLogic', () => {logic.unmount()})+ it('sends the date range with the search, re-searches on change, and syncs it with the URL', async () => {+ const logic = observationSearchLogic({ teamId: 1, userId: 'user-1' })+ logic.mount()+ router.actions.push(urls.replayVision(), { tab: 'search' })+ logic.actions.setDateRange('-30d', null)+ logic.actions.setQuery('confused users')+ await expectLogic(logic, () => logic.actions.search()).toFinishAllListeners()++ expect(searchSpy).toHaveBeenCalledTimes(1)+ const requestUrl = new URL(searchSpy.mock.calls[0][0].request.url)+ expect(requestUrl.searchParams.get('date_from')).toBe('-30d')+ expect(requestUrl.searchParams.get('date_to')).toBeNull()+ expect(router.values.searchParams.date_from).toBe('-30d')++ // A range change re-runs the shown search, like a scanner scope change does.+ await expectLogic(logic, () => logic.actions.setDateRange('-7d', '-1d')).toFinishAllListeners()+ expect(searchSpy).toHaveBeenCalledTimes(2)+ const secondRequest = new URL(searchSpy.mock.calls[1][0].request.url).searchParams+ expect([secondRequest.get('date_from'), secondRequest.get('date_to')]).toEqual(['-7d', '-1d'])++ // "All time" arrives as the DateFilter's `all` sentinel, which the search API rejects as a bound.+ await expectLogic(logic, () => logic.actions.setDateRange('all', null)).toFinishAllListeners()+ expect(searchSpy).toHaveBeenCalledTimes(3)+ expect(new URL(searchSpy.mock.calls[2][0].request.url).searchParams.get('date_from')).toBeNull()+ expect(logic.values.dateFrom).toBeNull()++ router.actions.push(urls.replayVision(), { tab: 'search', q: 'confused users', date_from: '-90d' })+ await expectLogic(logic).toFinishAllListeners()+ expect(logic.values.dateFrom).toBe('-90d')+ expect(logic.values.dateTo).toBeNull()+ logic.unmount()+ })++ it('checks every result and tags only the sessions whose recording the API omits', async () => {+ // created_at is analysis time, so it cannot rule expiry out for a backfilled scan of an old+ // session; every result's session goes in the one batched check, and only omitted ones are tagged.+ searchSpy.mockImplementation(() => [+ 200,+ {+ results: [+ { observation: { id: 'obs-1', session_id: 's-deleted' }, distance: 0.1 },+ { observation: { id: 'obs-2', session_id: 's-playable' }, distance: 0.11 },+ ],+ },+ ])+ const recordingsSpy: jest.Mock = jest.fn(() => [200, { results: [{ id: 's-playable' }], has_next: false }])+ useMocks({ get: { '/api/environments/:team_id/session_recordings': recordingsSpy } })++ const logic = observationSearchLogic({ teamId: 1, userId: 'user-1' })+ logic.mount()+ router.actions.push(urls.replayVision(), { tab: 'search' })+ logic.actions.setQuery('confused users')+ await expectLogic(logic, () => logic.actions.search()).toFinishAllListeners()++ expect(recordingsSpy).toHaveBeenCalledTimes(1)+ const requested = JSON.parse(+ new URL(recordingsSpy.mock.calls[0][0].request.url).searchParams.get('session_ids') ?? '[]'+ )+ expect(requested).toEqual(['s-deleted', 's-playable'])+ expect(logic.values.expiredSessionIds).toEqual(new Set(['s-deleted']))+ logic.unmount()+ })++ it('shows no expired tags and no error toast when the recordings check is forbidden', async () => {+ // A user with Replay Vision access but no session-recording access gets a 403 here; the check+ // must degrade to no tags rather than toast after every search.+ searchSpy.mockImplementation(() => [+ 200,+ { results: [{ observation: { id: 'obs-1', session_id: 's-1' }, distance: 0.1 }] },+ ])+ useMocks({ get: { '/api/environments/:team_id/session_recordings': () => [403, { detail: 'forbidden' }] } })+ const toastSpy = jest.spyOn(lemonToast, 'error').mockImplementation(() => 'toast-id')++ const logic = observationSearchLogic({ teamId: 1, userId: 'user-1' })+ logic.mount()+ router.actions.push(urls.replayVision(), { tab: 'search' })+ logic.actions.setQuery('confused users')+ await expectLogic(logic, () => logic.actions.search()).toFinishAllListeners()++ expect(logic.values.results?.map((r) => r.observation.id)).toEqual(['obs-1'])+ expect(logic.values.expiredSessionIds).toEqual(new Set())+ expect(toastSpy).not.toHaveBeenCalled()+ toastSpy.mockRestore()+ logic.unmount()+ })+it.each([['spread distances split off a top tier', [0.1, 0.12, 0.4], expect.closeTo(0.15)],['clustered distances stay one tier', [0.1, 0.12, 0.14], null],diff --git a/products/replay_vision/frontend/search/observationSearchLogic.ts b/products/replay_vision/frontend/search/observationSearchLogic.tsindex 41a5e7276c84..7bed9ae3f618 100644--- a/products/replay_vision/frontend/search/observationSearchLogic.ts+++ b/products/replay_vision/frontend/search/observationSearchLogic.ts@@ -15,10 +15,13 @@ import { loaders } from 'kea-loaders'import { actionToUrl, router, urlToAction } from 'kea-router'import posthog from 'posthog-js'+import api from 'lib/api'import { lemonToast } from 'lib/lemon-ui/LemonToast'import { teamLogic } from 'scenes/teamLogic'import { urls } from 'scenes/urls'+import { NodeKind } from '~/queries/schema/schema-general'+import {visionObservationsSearchRetrieve,visionObservationsSearchSuggestionsRetrieve,@@ -53,6 +56,9 @@ export interface ObservationSearchLogicProps {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface observationSearchLogicValues {+ dateFrom: string | null+ dateTo: string | null+ expiredSessionIds: Set<string>page: numberpageCount: numberpageEndIndex: number@@ -70,11 +76,28 @@ export interface observationSearchLogicValues {suggestedQueriesLoading: booleantopMatchDistanceCutoff: number | nulltruncated: boolean+ unavailableSessionIds: string[]+ unavailableSessionIdsLoading: booleanview: ResultsView}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface observationSearchLogicActions {+ checkRecordingAvailability: (sessionIds: string[]) => string[]+ checkRecordingAvailabilityFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ checkRecordingAvailabilitySuccess: (+ unavailableSessionIds: string[],+ payload?: string[]+ ) => {+ unavailableSessionIds: string[]+ payload?: string[]+ }clearSearch: () => {value: true}@@ -117,6 +140,13 @@ export interface observationSearchLogicActions {sourceObservationId: string | nulltruncated: boolean}+ setDateRange: (+ dateFrom: string | null,+ dateTo: string | null+ ) => {+ dateFrom: string | null+ dateTo: string | null+ }setPage: (page: number) => {page: number}@@ -135,6 +165,7 @@ export interface observationSearchLogicActions {export interface observationSearchLogicMeta {key: string__keaTypeGenInternalSelectorTypes: {+ expiredSessionIds: (unavailableSessionIds: string[]) => Set<string>pageCount: (results: ObservationSearchResultApi[] | null) => numberpageResults: (results: ObservationSearchResultApi[] | null, page: number) => ObservationSearchResultApi[]pageStartIndex: (page: number) => number@@ -170,6 +201,12 @@ export const observationSearchLogic = kea<observationSearchLogicType>([actions({setQuery: (query: string) => ({ query }),setScannerId: (scannerId: string | null) => ({ scannerId }),+ // The DateFilter's "All time" preset emits the `all` sentinel, which the search API rejects;+ // it expresses an unbounded range by omitting the bound.+ setDateRange: (dateFrom: string | null, dateTo: string | null) => ({+ dateFrom: dateFrom === 'all' ? null : dateFrom,+ dateTo: dateTo === 'all' ? null : dateTo,+ }),setPage: (page: number) => ({ page }),setView: (view: ResultsView) => ({ view }),search: true,@@ -204,6 +241,19 @@ export const observationSearchLogic = kea<observationSearchLogicType>([setScannerId: (_, { scannerId }) => scannerId,},],+ // Relative (`-30d`) or absolute bounds on when the observation was analyzed; null means unbounded.+ dateFrom: [+ null as string | null,+ {+ setDateRange: (_, { dateFrom }) => dateFrom,+ },+ ],+ dateTo: [+ null as string | null,+ {+ setDateRange: (_, { dateTo }) => dateTo,+ },+ ],// Provenance of the next search. Editing the prose makes it a regular search.pendingSourceObservationId: [null as string | null,@@ -277,9 +327,46 @@ export const observationSearchLogic = kea<observationSearchLogicType>([clearSearch: () => false,},],+ // Stale confirmations must not tag the next search's results while its own check is in flight.+ unavailableSessionIds: [+ [] as string[],+ {+ search: () => [],+ clearSearch: () => [],+ },+ ],}),loaders(({ values }) => ({+ // Searched sessions whose recording no longer exists. A recording keeps the retention period it+ // was captured under and the team setting can change afterwards, so expiry is confirmed against+ // the recordings API instead of being derived from the observation's age.+ unavailableSessionIds: [+ [] as string[],+ {+ checkRecordingAvailability: async (sessionIds: string[], breakpoint) => {+ if (sessionIds.length === 0) {+ return []+ }+ try {+ const response = await api.recordings.list({+ kind: NodeKind.RecordingsQuery,+ session_ids: sessionIds,+ })+ breakpoint()+ const playable = new Set(response.results.map((recording) => recording.id))+ return sessionIds.filter((sessionId) => !playable.has(sessionId))+ } catch (error) {+ if (error instanceof Error && isBreakpoint(error)) {+ throw error+ }+ // No session-recording access (403) or a transient failure: show no expired tags+ // rather than an error toast, since this action is not on initKea's allow list.+ return []+ }+ },+ },+ ],suggestedQueries: [[] as string[],{@@ -307,6 +394,10 @@ export const observationSearchLogic = kea<observationSearchLogicType>([})),selectors({+ expiredSessionIds: [+ (s) => [s.unavailableSessionIds],+ (unavailableSessionIds: string[]): Set<string> => new Set(unavailableSessionIds),+ ],pageCount: [(s) => [s.results],(results: ObservationSearchResultApi[] | null): number =>@@ -349,6 +440,18 @@ export const observationSearchLogic = kea<observationSearchLogicType>([actions.search()}},+ setDateRange: () => {+ if (values.searchedQuery !== null || values.searching) {+ actions.search()+ }+ },+ searchSuccess: ({ results }) => {+ // An observation is created when its scan runs, not when the session happened, so its age+ // cannot rule expiry out for a backfilled scan of an old session. The recordings API is the+ // source of truth, so check every result's session in one batched request (at most 50).+ const sessionIds = Array.from(new Set(results.map((result) => result.observation.session_id)))+ actions.checkRecordingAvailability(sessionIds)+ },searchSimilar: () => actions.search(),search: async (_, breakpoint) => {await breakpoint(SEARCH_COALESCE_MS)@@ -368,6 +471,8 @@ export const observationSearchLogic = kea<observationSearchLogicType>([q: query,limit: SEARCH_RESULT_LIMIT,...(values.scannerId ? { scanner_id: values.scannerId } : {}),+ ...(values.dateFrom ? { date_from: values.dateFrom } : {}),+ ...(values.dateTo ? { date_to: values.dateTo } : {}),})// Drop out-of-order responses. The newest search owns the results.breakpoint()@@ -420,6 +525,8 @@ export const observationSearchLogic = kea<observationSearchLogicType>([...router.values.searchParams,q,scanner: values.scannerId ?? undefined,+ date_from: values.dateFrom ?? undefined,+ date_to: values.dateTo ?? undefined,similar: values.pendingSourceObservationId ?? undefined,},router.values.hashParams,@@ -430,6 +537,7 @@ export const observationSearchLogic = kea<observationSearchLogicType>([search: () => withScope(values.pendingSourceObservationId ? undefined : values.query.trim() || undefined),clearSearch: () => withScope(undefined),setScannerId: () => withScope(router.values.searchParams.q),+ setDateRange: () => withScope(router.values.searchParams.q),}}),@@ -443,6 +551,11 @@ export const observationSearchLogic = kea<observationSearchLogicType>([if (scanner !== values.scannerId) {actions.setScannerId(scanner)}+ const dateFrom = typeof searchParams.date_from === 'string' ? searchParams.date_from : null+ const dateTo = typeof searchParams.date_to === 'string' ? searchParams.date_to : null+ if (dateFrom !== values.dateFrom || dateTo !== values.dateTo) {+ actions.setDateRange(dateFrom, dateTo)+ }const similar = typeof searchParams.similar === 'string' ? searchParams.similar : ''if (similar) {// Result links keep `similar` after typing cleared the pending source, so match the shown source too.