: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
fix(replay): keep vision scanner table interactable while polling (#66837)
Kim Svatos Duganab4b834fb51e
diff --git a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.test.ts b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.test.tsindex 8cf0ed4cf48a..22204419a671 100644--- a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.test.ts+++ b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.test.ts@@ -475,4 +475,28 @@ describe('replayScannerLogic', () => {expect(observeSpy).not.toHaveBeenCalled()})})++ describe('background polling', () => {+ it('background reloads stay silent so the table stays interactable, foreground loads do not', () => {+ const persisted = replayScannerLogic({ id: 'abc-123' })+ persisted.mount()+ try {+ // The initial foreground load (also manual refresh, filter/sort/pagination) shows the overlay.+ expect(persisted.values.observationsLoading).toBe(true)++ persisted.actions.loadObservationsSuccess([], 0)+ expect(persisted.values.observationsLoading).toBe(false)++ // The 3s in-flight poll reloads in the background — no overlay, so rows update in place.+ persisted.actions.loadObservations(true)+ expect(persisted.values.observationsLoading).toBe(false)++ // A foreground reload still shows it — proving the silent case isn't just a no-op action.+ persisted.actions.loadObservations()+ expect(persisted.values.observationsLoading).toBe(true)+ } finally {+ persisted.unmount()+ }+ })+ })})diff --git a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.tsindex 9e06e7026979..9dfe7e1d9122 100644--- a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts+++ b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts@@ -220,7 +220,7 @@ export const replayScannerLogic = kea<replayScannerLogicType>([loadScannerFailure: true,setScannerType: (scannerType: ScannerType) => ({ scannerType }),setSubmitIntent: (intent: 'save' | 'advance') => ({ intent }),- loadObservations: true,+ loadObservations: (background = false) => ({ background }),loadObservationsSuccess: (observations: ReplayObservationApi[], total: number) => ({ observations, total }),loadObservationsFailure: true,setObservationsPage: (page: number) => ({ page }),@@ -425,7 +425,9 @@ export const replayScannerLogic = kea<replayScannerLogicType>([observationsLoading: [false,{- loadObservations: () => true,+ // Background polls reload silently so the table stays interactable; only foreground+ // loads (initial paint, manual refresh, filter/sort/pagination) show the overlay.+ loadObservations: (state, { background }) => (background ? state : true),loadObservationsSuccess: () => false,loadObservationsFailure: () => false,},@@ -640,8 +642,8 @@ export const replayScannerLogic = kea<replayScannerLogicType>([}),listeners(({ actions, props, values, cache }) => {- const reloadObservationsAndStats = (): void => {- actions.loadObservations()+ const reloadObservationsAndStats = (background = false): void => {+ actions.loadObservations(background)actions.loadObservationStats()}return {@@ -885,7 +887,7 @@ export const replayScannerLogic = kea<replayScannerLogicType>([scheduleObservationPoll(cache.disposables,values.hasObservationsInFlight || Date.now() < values.pollUntil,- reloadObservationsAndStats+ () => reloadObservationsAndStats(true))},// Reschedule on failure too — a transient API hiccup shouldn't permanently kill the polling cycle.@@ -893,7 +895,7 @@ export const replayScannerLogic = kea<replayScannerLogicType>([scheduleObservationPoll(cache.disposables,values.hasObservationsInFlight || Date.now() < values.pollUntil,- reloadObservationsAndStats+ () => reloadObservationsAndStats(true))},}