From 4992e7d95c19a57dba7c7149d392a015ab48a8fe Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Fri, 10 Nov 2023 17:50:34 +0000 Subject: [PATCH] fix: invalid state detection (#18555) --- .../player/sessionRecordingDataLogic.ts | 2 +- .../player/sessionRecordingPlayerLogic.ts | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts b/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts index 09432f65621b9..5ef3588fcf7e0 100644 --- a/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts +++ b/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts @@ -632,7 +632,7 @@ export const sessionRecordingDataLogic = kea([ }) } - return everyWindowMissingFullSnapshot || anyWindowMissingFullSnapshot + return everyWindowMissingFullSnapshot }, ], diff --git a/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts b/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts index c9f2d39d0af6d..beb078ea9fe79 100644 --- a/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts +++ b/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts @@ -44,6 +44,7 @@ import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic' import { featureFlagLogic } from 'lib/logic/featureFlagLogic' import { FEATURE_FLAGS } from 'lib/constants' import type { sessionRecordingsPlaylistLogicType } from '../playlist/sessionRecordingsPlaylistLogicType' +import { subscriptions } from 'kea-subscriptions' export const PLAYBACK_SPEEDS = [0.5, 1, 2, 3, 4, 8, 16] export const ONE_FRAME_MS = 100 // We don't really have frames but this feels granular enough @@ -331,6 +332,13 @@ export const sessionRecordingPlayerLogic = kea( }, ], })), + subscriptions(({ actions }) => ({ + snapshotsInvalid: (value) => { + if (value) { + actions.setErrorPlayerState(true) + } + }, + })), selectors({ // Prop references for use by other logics sessionRecordingId: [() => [(_, props) => props], (props): string => props.sessionRecordingId], @@ -346,7 +354,6 @@ export const sessionRecordingPlayerLogic = kea( s.isSkippingInactivity, s.snapshotsLoaded, s.sessionPlayerSnapshotDataLoading, - s.snapshotsInvalid, ], ( playingState, @@ -355,13 +362,8 @@ export const sessionRecordingPlayerLogic = kea( isScrubbing, isSkippingInactivity, snapshotsLoaded, - snapshotsLoading, - snapshotsInvalid + snapshotsLoading ) => { - if (snapshotsInvalid) { - return SessionPlayerState.ERROR - } - if (isScrubbing) { // If scrubbing, playingState takes precedence return playingState