From 088a1324baeb78543e0e1a71d8a55fe97790d0e3 Mon Sep 17 00:00:00 2001 From: David Newell Date: Mon, 1 Jul 2024 11:32:47 +0100 Subject: [PATCH] chore: only show recording as invalid when no warnings present (#23339) --- .../player/SessionRecordingPlayer.tsx | 12 +++++++++--- .../player/sessionRecordingDataLogic.ts | 4 +--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/frontend/src/scenes/session-recordings/player/SessionRecordingPlayer.tsx b/frontend/src/scenes/session-recordings/player/SessionRecordingPlayer.tsx index 20dac8bb0ab24..688884c50942c 100644 --- a/frontend/src/scenes/session-recordings/player/SessionRecordingPlayer.tsx +++ b/frontend/src/scenes/session-recordings/player/SessionRecordingPlayer.tsx @@ -4,6 +4,7 @@ import { LemonButton, LemonSegmentedButton, LemonSegmentedButtonOption, LemonTag import clsx from 'clsx' import { BindLogic, useActions, useValues } from 'kea' import { BuilderHog2 } from 'lib/components/hedgehogs' +import { dayjs } from 'lib/dayjs' import { useFeatureFlag } from 'lib/hooks/useFeatureFlag' import { FloatingContainerContext } from 'lib/hooks/useFloatingContainerContext' import { HotkeysInterface, useKeyboardHotkeys } from 'lib/hooks/useKeyboardHotkeys' @@ -93,9 +94,11 @@ export function SessionRecordingPlayer(props: SessionRecordingPlayerProps): JSX. setSpeed, closeExplorer, } = useActions(sessionRecordingPlayerLogic(logicProps)) - const { isNotFound, snapshotsInvalid } = useValues(sessionRecordingDataLogic(logicProps)) + const { isNotFound, snapshotsInvalid, start } = useValues(sessionRecordingDataLogic(logicProps)) const { loadSnapshots } = useActions(sessionRecordingDataLogic(logicProps)) - const { isFullScreen, explorerMode, isBuffering } = useValues(sessionRecordingPlayerLogic(logicProps)) + const { isFullScreen, explorerMode, isBuffering, messageTooLargeWarnings } = useValues( + sessionRecordingPlayerLogic(logicProps) + ) const speedHotkeys = useMemo(() => createPlaybackSpeedKey(setSpeed), [setSpeed]) const { preferredInspectorStacking, playbackViewMode } = useValues(playerSettingsLogic) const { setPreferredInspectorStacking, setPlaybackViewMode } = useActions(playerSettingsLogic) @@ -168,6 +171,9 @@ export function SessionRecordingPlayer(props: SessionRecordingPlayerProps): JSX. const layoutStacking = compactLayout ? InspectorStacking.Vertical : preferredInspectorStacking const isVerticallyStacked = layoutStacking === InspectorStacking.Vertical + const lessThanFiveMinutesOld = dayjs().diff(start, 'minute') <= 5 + const cannotPlayback = snapshotsInvalid && lessThanFiveMinutesOld && !messageTooLargeWarnings + const { draggable, elementProps } = useNotebookDrag({ href: urls.replaySingle(sessionRecordingId) }) if (isNotFound) { @@ -244,7 +250,7 @@ export function SessionRecordingPlayer(props: SessionRecordingPlayerProps): JSX. })} ref={playerMainRef} > - {snapshotsInvalid ? ( + {cannotPlayback ? (

We're still working on it

diff --git a/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts b/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts index c72be208bd6cc..283f0ecea7e7b 100644 --- a/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts +++ b/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts @@ -855,9 +855,7 @@ export const sessionRecordingDataLogic = kea([ }) } - const minutesSinceRecording = dayjs().diff(start, 'minute') - - return everyWindowMissingFullSnapshot && minutesSinceRecording <= 5 + return everyWindowMissingFullSnapshot }, ],