Skip to content

: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.

chore(replay): revert the follow live mode in the player (#118868)

HaynesPostHog4cc4771532e3
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index ff7154dc75ca..5198b519a73f 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -523,7 +523,6 @@ export const FEATURE_FLAGS = {
REPLAY_DEBUG_WITH_AI: 'replay-debug-with-ai', // owner: @clr182 #team-replay, player button that sends the recording JSON to PostHog AI
REPLAY_EVENT_MATCH_SCOPE: 'replay-event-match-scope', // owner: @pauldambra #team-replay, shows the "Match the whole session / only during recording" filter select
REPLAY_FILTERS_REDESIGN: 'replay-filters-redesign', // owner: @ksvat #team-replay
- REPLAY_FOLLOW_LIVE: 'replay-follow-live', // owner: #team-replay, player toggle that keeps an ongoing recording playing as new data arrives
REPLAY_NEGATIVE_EVENT_FILTERS: 'replay-negative-event-filters', // owner: @arnohillen #team-replay
REPLAY_PLAYLIST_SURFACING_SCORE: 'replay-playlist-surfacing-score', // owner: #team-replay
REPLAY_RECOMMENDED_RECORDINGS_FILTER_EXPERIMENT: 'replay-recommended-recordings-filter-experiment', // owner: @arnohillen #team-replay multivariate=control,test
diff --git a/frontend/src/scenes/session-recordings/player/controller/FollowLive.tsx b/frontend/src/scenes/session-recordings/player/controller/FollowLive.tsx
deleted file mode 100644
index bbba3411823e..000000000000
--- a/frontend/src/scenes/session-recordings/player/controller/FollowLive.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import { useActions, useValues } from 'kea'
-
-import { IconLive } from '@posthog/icons'
-import { LemonButton } from '@posthog/lemon-ui'
-
-import { FEATURE_FLAGS } from 'lib/constants'
-import { cn } from 'lib/utils/css-classes'
-import { sessionRecordingPlayerLogic } from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'
-
-export function FollowLive(): JSX.Element | null {
- const { followLive, sessionPlayerMetaData, featureFlags } = useValues(sessionRecordingPlayerLogic)
- const { setFollowLive } = useActions(sessionRecordingPlayerLogic)
-
- if (!featureFlags[FEATURE_FLAGS.REPLAY_FOLLOW_LIVE] || !sessionPlayerMetaData?.ongoing) {
- return null
- }
-
- return (
- <LemonButton
- size="xsmall"
- active={followLive}
- onClick={() => setFollowLive(!followLive)}
- tooltip={
- followLive
- ? 'Stop following live'
- : 'Follow live. New activity plays as it arrives, about 30 seconds behind.'
- }
- icon={<IconLive className={cn('text-xl', followLive && 'text-danger motion-safe:animate-pulse')} />}
- data-attr={followLive ? 'recording-follow-live-stop' : 'recording-follow-live-start'}
- >
- Live
- </LemonButton>
- )
-}
diff --git a/frontend/src/scenes/session-recordings/player/controller/PlayerController.tsx b/frontend/src/scenes/session-recordings/player/controller/PlayerController.tsx
index 5547c47a78d6..7fb3a2615d96 100644
--- a/frontend/src/scenes/session-recordings/player/controller/PlayerController.tsx
+++ b/frontend/src/scenes/session-recordings/player/controller/PlayerController.tsx
@@ -24,7 +24,6 @@ import {
import { SessionPlayerState } from '~/types'
import { ClipRecording } from './ClipRecording'
-import { FollowLive } from './FollowLive'
import { SeekSkip, Timestamp } from './PlayerControllerTime'
import { Seekbar } from './Seekbar'
@@ -108,8 +107,7 @@ function SkipToStart(): JSX.Element {
function SkipToNext(): JSX.Element | null {
const timeoutRef = useRef<NodeJS.Timeout>()
- const { endReached, followLive, playNextAnimationInterrupted, playNextRecording } =
- useValues(sessionRecordingPlayerLogic)
+ const { endReached, playNextAnimationInterrupted, playNextRecording } = useValues(sessionRecordingPlayerLogic)
const { reportNextRecordingTriggered, setPlayNextAnimationInterrupted } = useActions(sessionRecordingPlayerLogic)
const [animate, setAnimate] = useState(false)
@@ -138,7 +136,7 @@ function SkipToNext(): JSX.Element | null {
useEffect(() => {
clearTimeout(timeoutRef.current)
- if (endReached && playNextRecording && !followLive) {
+ if (endReached && playNextRecording) {
setAnimate(true)
setPlayNextAnimationInterrupted(false)
timeoutRef.current = setTimeout(() => {
@@ -147,7 +145,7 @@ function SkipToNext(): JSX.Element | null {
}
return () => clearTimeout(timeoutRef.current)
- }, [endReached, followLive, !!playNextRecording]) // eslint-disable-line react-hooks/exhaustive-deps
+ }, [endReached, !!playNextRecording]) // eslint-disable-line react-hooks/exhaustive-deps
useEffect(() => {
if (playNextAnimationInterrupted) {
@@ -243,7 +241,6 @@ export function PlayerController(): JSX.Element {
<SeekSkip direction="forward" />
<SkipToNext />
<Timestamp size={size} />
- <FollowLive />
</div>
<div className="flex gap-0.5 justify-end items-center">
{ModesWithInteractions.includes(playerMode) && (
diff --git a/frontend/src/scenes/session-recordings/player/sessionRecordingDataCoordinatorLogic.test.ts b/frontend/src/scenes/session-recordings/player/sessionRecordingDataCoordinatorLogic.test.ts
index ec5d4db3eedf..aad51e2b3d55 100644
--- a/frontend/src/scenes/session-recordings/player/sessionRecordingDataCoordinatorLogic.test.ts
+++ b/frontend/src/scenes/session-recordings/player/sessionRecordingDataCoordinatorLogic.test.ts
@@ -8,22 +8,14 @@ import { processAllSnapshots, SnapshotSourceType, SourceKey, ViewportResolution
import { dayjs } from 'lib/dayjs'
import { convertSnapshotsByWindowId } from 'scenes/session-recordings/__mocks__/recording_snapshots'
-import {
- recordingDurationMs,
- sessionRecordingDataCoordinatorLogic,
-} from 'scenes/session-recordings/player/sessionRecordingDataCoordinatorLogic'
+import { sessionRecordingDataCoordinatorLogic } from 'scenes/session-recordings/player/sessionRecordingDataCoordinatorLogic'
import { sessionRecordingMetaLogic } from 'scenes/session-recordings/player/sessionRecordingMetaLogic'
import { teamLogic } from 'scenes/teamLogic'
import { userLogic } from 'scenes/userLogic'
import { resumeKeaLoadersErrors, silenceKeaLoadersErrors } from '~/initKea'
import { HogQLQueryResponse } from '~/queries/schema/schema-general'
-import {
- RecordingSnapshot,
- SessionRecordingSnapshotSource,
- SessionRecordingSnapshotSourceResponse,
- SessionRecordingType,
-} from '~/types'
+import { RecordingSnapshot, SessionRecordingSnapshotSource, SessionRecordingSnapshotSourceResponse } from '~/types'
import { sortedRecordingSnapshots } from '../__mocks__/recording_snapshots'
import { sessionRecordingEventUsageLogic } from '../sessionRecordingEventUsageLogic'
@@ -59,22 +51,6 @@ describe('sessionRecordingDataCoordinatorLogic', () => {
jest.spyOn(api, 'create')
})
- describe('recordingDurationMs', () => {
- const start = dayjs('2023-08-11T12:00:00Z')
- const end = start.add(20, 'second')
- const meta = { recording_duration: 10 } as SessionRecordingType
-
- it.each([
- { livePolling: false, expected: 10000 },
- { livePolling: true, expected: 20000 },
- ])(
- 'caps a fully loaded recording at the metadata duration unless live: $livePolling',
- ({ livePolling, expected }) => {
- expect(recordingDurationMs(start, end, meta, true, livePolling)).toBe(expected)
- }
- )
- })
-
describe('core assumptions', () => {
it('mounts other logics', async () => {
await expectLogic(logic).toMount([sessionRecordingEventUsageLogic, teamLogic, userLogic])
diff --git a/frontend/src/scenes/session-recordings/player/sessionRecordingDataCoordinatorLogic.ts b/frontend/src/scenes/session-recordings/player/sessionRecordingDataCoordinatorLogic.ts
index 108a79f1830e..b7f05288e87d 100644
--- a/frontend/src/scenes/session-recordings/player/sessionRecordingDataCoordinatorLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/sessionRecordingDataCoordinatorLogic.ts
@@ -234,24 +234,6 @@ export interface SessionRecordingDataCoordinatorLogicProps {
// ~5 minutes but measure from different events, so tune them together, not in isolation.
export const INGESTION_GRACE_PERIOD_MINUTES = 5
-export function recordingDurationMs(
- start: Dayjs | null,
- end: Dayjs | null,
- meta: SessionRecordingType | null,
- fullyLoaded: boolean,
- livePolling: boolean
-): number {
- if (!start || !end) {
- return 0
- }
- const snapshotDuration = end.diff(start)
- // metadata is not reloaded while live, so its duration falls behind the new snapshots
- if (fullyLoaded && meta?.recording_duration && !livePolling) {
- return Math.min(snapshotDuration, meta.recording_duration * 1000)
- }
- return snapshotDuration
-}
-
export function isWithinIngestionGracePeriod(start: Dayjs | null): boolean {
return start != null && now().diff(start, 'minute') <= INGESTION_GRACE_PERIOD_MINUTES
}
@@ -284,7 +266,6 @@ export interface sessionRecordingDataCoordinatorLogicValues {
snapshotsLoading: boolean // metaLogic
trackedWindow: number | null // metaLogic
uuidToIndex: Record<string, number> // metaLogic
- livePolling: boolean // snapLogic
snapshotStore: SnapshotStore // snapLogic
sourceLoadingStates: SourceLoadingState[] // snapLogic
storeVersion: number // snapLogic
@@ -510,8 +491,7 @@ export interface sessionRecordingDataCoordinatorLogicMeta {
start: Dayjs | null,
end: Dayjs | null,
sessionPlayerMetaData: SessionRecordingType | null,
- fullyLoaded: boolean,
- livePolling: boolean
+ fullyLoaded: boolean
) => number
segments: (
snapshots: import('@posthog/replay-shared').RecordingSnapshot[],
@@ -673,7 +653,7 @@ export const sessionRecordingDataCoordinatorLogic = kea<sessionRecordingDataCoor
'sessionNotebookCommentsLoading',
],
snapLogic,
- ['snapshotStore', 'storeVersion', 'sourceLoadingStates', 'livePolling'],
+ ['snapshotStore', 'storeVersion', 'sourceLoadingStates'],
],
}
}),
@@ -912,14 +892,22 @@ export const sessionRecordingDataCoordinatorLogic = kea<sessionRecordingDataCoor
],
durationMs: [
- (s) => [s.start, s.end, s.sessionPlayerMetaData, s.fullyLoaded, s.livePolling],
+ (s) => [s.start, s.end, s.sessionPlayerMetaData, s.fullyLoaded],
(
start: Dayjs | null,
end: Dayjs | null,
meta: SessionRecordingType | null,
- fullyLoaded: boolean,
- livePolling: boolean
- ): number => recordingDurationMs(start, end, meta, fullyLoaded, livePolling),
+ fullyLoaded: boolean
+ ): number => {
+ if (!start || !end) {
+ return 0
+ }
+ const snapshotDuration = end.diff(start)
+ if (fullyLoaded && meta?.recording_duration) {
+ return Math.min(snapshotDuration, meta.recording_duration * 1000)
+ }
+ return snapshotDuration
+ },
],
segments: [
diff --git a/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts b/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts
index 95b809816a68..b842b2847fc5 100644
--- a/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts
@@ -125,7 +125,6 @@ export const ONE_SECOND_MS = 1000
// shows its error.
const MAX_PLAYER_FRAME_LOAD_RETRIES = 2
const PLAYER_FRAME_RETRY_DELAY_MS = 1000
-const LIVE_EDGE_OFFSET_MS = 5000
export type { ResourceErrorDetails, GroupedAssetErrors, DoctorDiagnostics } from './utils/asset-error-grouping'
@@ -814,8 +813,6 @@ export interface sessionRecordingPlayerLogicValues {
endReached: boolean
errorCount: number
explorerMode: SessionRecordingPlayerExplorerProps | null
- followLive: boolean
- followLiveRequested: boolean
forceShowPlayerChrome: boolean
fromRRWebPlayerTime: (time?: number | undefined) => number | undefined
hasLateFullSnapshot: boolean
@@ -835,7 +832,6 @@ export interface sessionRecordingPlayerLogicValues {
jumpTimeMs: number
leadingRecoveryTimestamp: number | null
leadingUnplayableMs: number
- liveWaitingForData: boolean
logicProps: SessionRecordingPlayerLogicProps
maskingWindow: boolean
matchingEventSkipTarget: MatchingEventSkipTarget
@@ -1015,9 +1011,6 @@ export interface sessionRecordingPlayerLogicActions {
retrySnapshotLoading: () => {
value: true
} // snapshotDataLogic
- setLivePolling: (enabled: boolean) => {
- enabled: boolean
- } // snapshotDataLogic
setPlayerActive: (active: boolean) => {
active: boolean
} // snapshotDataLogic
@@ -1196,9 +1189,6 @@ export interface sessionRecordingPlayerLogicActions {
setExplorerProps: (props: SessionRecordingPlayerExplorerProps | null) => {
props: SessionRecordingPlayerExplorerProps | null
}
- setFollowLive: (followLive: boolean) => {
- followLive: boolean
- }
setIsCommenting: (isCommenting: boolean) => {
isCommenting: boolean
}
@@ -1318,7 +1308,6 @@ export interface sessionRecordingPlayerLogicActions {
export interface sessionRecordingPlayerLogicMeta {
key: string
__keaTypeGenInternalSelectorTypes: {
- followLive: (followLiveRequested: boolean, featureFlags: FeatureFlagsSet) => boolean
playerFrameDocumentFailed: (playerFrameLoadFailures: number, playerFrameLoadStopped: boolean) => boolean
sessionRecordingId: (sessionRecordingId: string) => string
logicProps: (arg: any) => SessionRecordingPlayerLogicProps
@@ -1558,7 +1547,6 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(
'setTargetTimestamp',
'updatePlaybackPosition',
'setPlayerActive',
- 'setLivePolling',
],
sessionRecordingDataCoordinatorLogic(props),
['loadRecordingData', 'loadRecordingMetaSuccess', 'snapshotProcessingFailed'],
@@ -1588,7 +1576,6 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(
setPlay: true,
setPause: true,
setEndReached: (reached: boolean = true) => ({ reached }),
- setFollowLive: (followLive: boolean) => ({ followLive }),
startBuffer: true,
endBuffer: true,
startScrub: true,
@@ -1875,23 +1862,6 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(
initializePlayerFromStart: () => null,
},
],
- followLiveRequested: [
- false,
- {
- setFollowLive: (_, { followLive }) => followLive,
- },
- ],
- // separate from endReached, which replayer re-init clears, so Live still resumes after a tab switch
- liveWaitingForData: [
- false,
- {
- setEndReached: (_, { reached }) => reached,
- setFollowLive: () => false,
- setPlay: () => false,
- openExplorer: () => false,
- setIsCommenting: (state, { isCommenting }) => (isCommenting ? false : state),
- },
- ],
endReached: [
false,
{
@@ -1949,11 +1919,6 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(
],
})),
selectors({
- followLive: [
- (s) => [s.followLiveRequested, s.featureFlags],
- (requested: boolean, featureFlags: FeatureFlagsSet): boolean =>
- requested && !!featureFlags[FEATURE_FLAGS.REPLAY_FOLLOW_LIVE],
- ],
// Nothing resets this, because the frame's src stops changing once the retries run out.
playerFrameDocumentFailed: [
(s) => [s.playerFrameLoadFailures, s.playerFrameLoadStopped],
@@ -3356,20 +3321,6 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(
actions.syncPlayerSpeed() // hotfix: speed changes on player state change
values.player?.replayer?.pause()
},
- setFollowLive: ({ followLive }) => {
- if (!values.featureFlags[FEATURE_FLAGS.REPLAY_FOLLOW_LIVE]) {
- return
- }
- posthog.capture('recording follow live toggled', { follow_live: followLive })
- actions.setLivePolling(followLive)
- const end = values.sessionPlayerData.end?.valueOf()
- if (followLive && end) {
- const start = values.sessionPlayerData.start?.valueOf() ?? end
- actions.setCurrentTimestamp(Math.max(start, end - LIVE_EDGE_OFFSET_MS))
- actions.setEndReached(false)
- actions.setPlay()
- }
- },
setEndReached: ({ reached }) => {
if (reached) {
actions.endBuffer()
@@ -3997,13 +3948,6 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(
if (hasSnapshotChanges) {
actions.syncSnapshotsWithPlayer()
-
- const endGrew = (value?.end?.valueOf() ?? 0) > (oldValue?.end?.valueOf() ?? 0)
- if (values.followLive && values.liveWaitingForData && endGrew) {
- // resume from the old end, not from the start as setPlay does after endReached
- actions.setEndReached(false)
- actions.setPlay()
- }
}
},
timestampChangeTracking: (value) => {
diff --git a/frontend/src/scenes/session-recordings/player/snapshotDataLogic.test.ts b/frontend/src/scenes/session-recordings/player/snapshotDataLogic.test.ts
index f7d70d419973..2b73fc971a29 100644
--- a/frontend/src/scenes/session-recordings/player/snapshotDataLogic.test.ts
+++ b/frontend/src/scenes/session-recordings/player/snapshotDataLogic.test.ts
@@ -4,8 +4,6 @@ import { EventType, IncrementalSource, NodeType, mutationData } from 'posthog-js
import { chunkMutationSnapshot, MUTATION_CHUNK_SIZE } from '@posthog/replay-shared'
import { ApiError, RecordingDeletedError } from 'lib/api'
-import { FEATURE_FLAGS } from 'lib/constants'
-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { encodedWebSnapshotData } from 'scenes/session-recordings/player/__mocks__/encoded-snapshot-data'
import { parseEncodedSnapshots } from 'scenes/session-recordings/player/snapshot-processing/process-all-snapshots'
@@ -41,33 +39,6 @@ describe('snapshotDataLogic', () => {
logic.mount()
})
- describe('follow live flag gate', () => {
- it.each([
- { flagOn: false, polls: false },
- { flagOn: true, polls: true },
- ])(
- 'with the flag on: $flagOn, a live request polls before all sources load: $polls',
- async ({ flagOn, polls }) => {
- featureFlagLogic.actions.setFeatureFlags([], { [FEATURE_FLAGS.REPLAY_FOLLOW_LIVE]: flagOn })
- const pollingLogic = snapshotDataLogic({
- sessionRecordingId: 'live-gate',
- blobV2PollingDisabled: false,
- })
- pollingLogic.mount()
-
- const expectation = expectLogic(pollingLogic, () => pollingLogic.actions.setLivePolling(true))
- if (polls) {
- await expectation.toDispatchActions(['startPolling'])
- } else {
- await expectation.toNotHaveDispatchedActions(['startPolling'])
- }
- expect(pollingLogic.values.livePolling).toBe(flagOn)
-
- pollingLogic.unmount()
- }
- )
- })
-
describe('recording deleted selectors', () => {
it('isRecordingDeleted is false when no error', () => {
expect(logic.values.isRecordingDeleted).toBe(false)
diff --git a/frontend/src/scenes/session-recordings/player/snapshotDataLogic.tsx b/frontend/src/scenes/session-recordings/player/snapshotDataLogic.tsx
index ea0469730204..4036edddb0b7 100644
--- a/frontend/src/scenes/session-recordings/player/snapshotDataLogic.tsx
+++ b/frontend/src/scenes/session-recordings/player/snapshotDataLogic.tsx
@@ -21,9 +21,7 @@ import { keyForSource } from '@posthog/replay-shared'
import { SnapshotSourceType, SnapshotStore, SourceLoadingState } from '@posthog/replay-shared'
import api, { ApiError, RecordingDeletedError } from 'lib/api'
-import { FEATURE_FLAGS } from 'lib/constants'
import 'lib/dayjs'
-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { parseEncodedSnapshots } from 'scenes/session-recordings/player/snapshot-processing/process-all-snapshots'
import { windowIdRegistryLogic } from 'scenes/session-recordings/player/windowIdRegistryLogic'
@@ -35,13 +33,11 @@ import {
SessionRecordingSnapshotSourceResponse,
} from '~/types'
-import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
import { SeekTarget, planNextBatch } from './snapshot-store/planNextBatch'
const DEFAULT_V2_POLLING_INTERVAL_MS: number = 10000
const MAX_V2_POLLING_INTERVAL_MS = 60000
const POLLING_INACTIVITY_TIMEOUT_MS = 5 * MAX_V2_POLLING_INTERVAL_MS
-const LIVE_POLLING_INTERVAL_MS = 5000
export interface SnapshotLogicProps {
sessionRecordingId: SessionRecordingId
@@ -52,7 +48,6 @@ export interface SnapshotLogicProps {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface snapshotDataLogicValues {
- featureFlags: FeatureFlagsSet // featureFlagLogic
getWindowId: (uuid: string | undefined) => number | undefined // windowIdRegistryLogic
uuidToIndex: Record<string, number> // windowIdRegistryLogic
allSourcesLoaded: boolean
@@ -60,8 +55,6 @@ export interface snapshotDataLogicValues {
isPolling: boolean
isRecordingDeleted: boolean
isSnapshotUnauthorized: boolean
- livePolling: boolean
- livePollingRequested: boolean
loadAllMode: boolean
loadingSources: Pick<SessionRecordingSnapshotSource, 'blob_key' | 'end_timestamp' | 'source' | 'start_timestamp'>[]
pollingInterval: number
@@ -163,9 +156,6 @@ export interface snapshotDataLogicActions {
retrySnapshotLoading: () => {
value: true
}
- setLivePolling: (enabled: boolean) => {
- enabled: boolean
- }
setPlayerActive: (active: boolean) => {
active: boolean
}
@@ -210,7 +200,6 @@ export interface snapshotDataLogicActions {
export interface snapshotDataLogicMeta {
key: string
__keaTypeGenInternalSelectorTypes: {
- livePolling: (livePollingRequested: boolean, featureFlags: FeatureFlagsSet) => boolean
snapshotsLoading: (
snapshotSourcesLoading: boolean,
snapshotsForSourceLoading: boolean,
@@ -259,8 +248,6 @@ export const snapshotDataLogic = kea<snapshotDataLogicType>([
values: [
windowIdRegistryLogic({ sessionRecordingId: props.sessionRecordingId }),
['uuidToIndex', 'getWindowId'],
- featureFlagLogic,
- ['featureFlags'],
],
})),
actions({
@@ -281,7 +268,6 @@ export const snapshotDataLogic = kea<snapshotDataLogicType>([
maybeStartPolling: true,
startPolling: true,
stopPolling: true,
- setLivePolling: (enabled: boolean) => ({ enabled }),
setPollingInterval: (intervalMs: number) => ({ intervalMs }),
resetPollingInterval: true,
setTargetTimestamp: (timestamp: number | null, windowId?: number) => ({ timestamp, windowId }),
@@ -333,12 +319,6 @@ export const snapshotDataLogic = kea<snapshotDataLogicType>([
resetPollingInterval: () => DEFAULT_V2_POLLING_INTERVAL_MS,
},
],
- livePollingRequested: [
- false,
- {
- setLivePolling: (_, { enabled }) => enabled,
- },
- ],
isPolling: [
false,
{
@@ -640,9 +620,7 @@ export const snapshotDataLogic = kea<snapshotDataLogicType>([
if (!props.sessionRecordingId) {
return
}
- // a live jump to the end leaves earlier sources unloaded, and new blocks must still arrive
- const waitingOnSources = !values.allSourcesLoaded && !values.livePolling
- if (props.blobV2PollingDisabled || waitingOnSources || values.isPolling || document.hidden) {
+ if (props.blobV2PollingDisabled || !values.allSourcesLoaded || values.isPolling || document.hidden) {
return
}
@@ -654,16 +632,7 @@ export const snapshotDataLogic = kea<snapshotDataLogicType>([
}
actions.startPolling()
- actions.loadSnapshotSources(values.livePolling ? LIVE_POLLING_INTERVAL_MS : values.pollingInterval)
- },
-
- setLivePolling: () => {
- if (values.livePolling) {
- cache.lastSourcesChangeTime = Date.now()
- // replaces a poll that may be waiting out a long backoff
- actions.stopPolling()
- actions.maybeStartPolling()
- }
+ actions.loadSnapshotSources(values.pollingInterval)
},
loadNextSnapshotSource: async (_, breakpoint) => {
@@ -702,11 +671,6 @@ export const snapshotDataLogic = kea<snapshotDataLogicType>([
},
})),
selectors(({ cache }) => ({
- livePolling: [
- (s) => [s.livePollingRequested, s.featureFlags],
- (requested: boolean, featureFlags: FeatureFlagsSet): boolean =>
- requested && !!featureFlags[FEATURE_FLAGS.REPLAY_FOLLOW_LIVE],
- ],
snapshotsLoading: [
(s) => [s.snapshotSourcesLoading, s.snapshotsForSourceLoading, s.storeVersion],
(snapshotSourcesLoading: boolean, snapshotsForSourceLoading: boolean, _storeVersion: number): boolean => {