Skip to content

Commit 499f43a

Browse files
emir-karabegclaude
andcommitted
fix(posthog): guard startSessionRecording against repeated calls on refetch
The effect fires on every session reload (e.g., subscription upgrade). Calling startSessionRecording() while already recording fragments the session in the analytics dashboard. Add sessionRecordingStarted() guard so recording only starts once per page lifecycle. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 21d8cd0 commit 499f43a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

apps/sim/app/_shell/providers/session-provider.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ export function SessionProvider({ children }: { children: React.ReactNode }) {
9292
email_verified: data.user.emailVerified,
9393
created_at: data.user.createdAt,
9494
})
95-
if (typeof posthog.startSessionRecording === 'function') {
95+
if (
96+
typeof posthog.startSessionRecording === 'function' &&
97+
!posthog.sessionRecordingStarted()
98+
) {
9699
posthog.startSessionRecording()
97100
}
98101
} else {

0 commit comments

Comments
 (0)