Skip to content

Commit 22f228c

Browse files
authored
feat(inbox): Show when replay analysis is in progress (#1621)
## Problem It wasn't possible to see when a round of replay analysis is happening in signal source config, which is especially good feedback right after enabling the Session Replay source. We already had this in the Cloud inbox, but haven't hooked up here. Now that we're back onto Session Replay, it's time to get the info in. ## Changes Source config status is now hooked up for Session Replay: <img width="976" height="294" alt="CleanShot 2026-04-13 at 17 29 45@2x" src="https://github.com/user-attachments/assets/c55e570d-a8bb-4275-9f66-85be1f0454e5" /> Feels like we should also have it for Error Tracking, but that works a little differently from Session Replay background analysis, needs to be connected to `SignalSourceConfig.status`. @oliverb123
1 parent fa4111f commit 22f228c

4 files changed

Lines changed: 55 additions & 1 deletion

File tree

apps/code/src/renderer/api/posthogClient.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export interface SignalSourceConfig {
5353
config: Record<string, unknown>;
5454
created_at: string;
5555
updated_at: string;
56+
status: "running" | "completed" | "failed" | null;
5657
}
5758

5859
export interface ExternalDataSourceSchema {

apps/code/src/renderer/features/inbox/components/SignalSourceToggles.tsx

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
ArrowSquareOutIcon,
33
BrainIcon,
44
BugIcon,
5+
CircleNotchIcon,
56
GithubLogoIcon,
67
KanbanIcon,
78
TicketIcon,
@@ -16,7 +17,10 @@ import {
1617
Switch,
1718
Text,
1819
} from "@radix-ui/themes";
19-
import type { Evaluation } from "@renderer/api/posthogClient";
20+
import type {
21+
Evaluation,
22+
SignalSourceConfig,
23+
} from "@renderer/api/posthogClient";
2024
import { memo, useCallback } from "react";
2125

2226
export interface SignalSourceValues {
@@ -37,6 +41,7 @@ interface SignalSourceToggleCardProps {
3741
requiresSetup?: boolean;
3842
onSetup?: () => void;
3943
loading?: boolean;
44+
statusSection?: React.ReactNode;
4045
}
4146

4247
const SignalSourceToggleCard = memo(function SignalSourceToggleCard({
@@ -49,6 +54,7 @@ const SignalSourceToggleCard = memo(function SignalSourceToggleCard({
4954
requiresSetup,
5055
onSetup,
5156
loading,
57+
statusSection,
5258
}: SignalSourceToggleCardProps) {
5359
return (
5460
<Box
@@ -101,6 +107,7 @@ const SignalSourceToggleCard = memo(function SignalSourceToggleCard({
101107
/>
102108
)}
103109
</Flex>
110+
{statusSection && <Box style={{ marginLeft: 32 }}>{statusSection}</Box>}
104111
</Box>
105112
);
106113
});
@@ -210,6 +217,30 @@ export const EvaluationsSection = memo(function EvaluationsSection({
210217
);
211218
});
212219

220+
function SourceRunningIndicator({
221+
status,
222+
message,
223+
}: {
224+
status: SignalSourceConfig["status"];
225+
message: string;
226+
}) {
227+
if (status !== "running") {
228+
return null;
229+
}
230+
return (
231+
<Flex align="center" gap="2" mt="2">
232+
<CircleNotchIcon
233+
size={14}
234+
className="animate-spin"
235+
style={{ color: "var(--accent-11)" }}
236+
/>
237+
<Text size="1" style={{ color: "var(--accent-11)" }}>
238+
{message}
239+
</Text>
240+
</Flex>
241+
);
242+
}
243+
213244
interface SignalSourceTogglesProps {
214245
value: SignalSourceValues;
215246
onToggle: (source: keyof SignalSourceValues, enabled: boolean) => void;
@@ -220,6 +251,7 @@ interface SignalSourceTogglesProps {
220251
{ requiresSetup: boolean; loading: boolean }
221252
>
222253
>;
254+
sessionAnalysisStatus?: SignalSourceConfig["status"];
223255
onSetup?: (source: keyof SignalSourceValues) => void;
224256
evaluations?: Evaluation[];
225257
evaluationsUrl?: string;
@@ -231,6 +263,7 @@ export function SignalSourceToggles({
231263
onToggle,
232264
disabled,
233265
sourceStates,
266+
sessionAnalysisStatus,
234267
onSetup,
235268
evaluations,
236269
evaluationsUrl,
@@ -269,6 +302,14 @@ export function SignalSourceToggles({
269302
checked={value.session_replay}
270303
onCheckedChange={toggleSessionReplay}
271304
disabled={disabled}
305+
statusSection={
306+
value.session_replay ? (
307+
<SourceRunningIndicator
308+
status={sessionAnalysisStatus ?? null}
309+
message="Session analysis run in progress now…"
310+
/>
311+
) : undefined
312+
}
272313
/>
273314
<SignalSourceToggleCard
274315
icon={<BugIcon size={20} />}

apps/code/src/renderer/features/inbox/hooks/useSignalSourceManager.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,15 @@ export function useSignalSourceManager() {
130130
[configs],
131131
);
132132

133+
const sessionAnalysisStatus = useMemo(() => {
134+
const config = configs?.find(
135+
(c) =>
136+
c.source_product === "session_replay" &&
137+
c.source_type === "session_analysis_cluster",
138+
);
139+
return config?.status ?? null;
140+
}, [configs]);
141+
133142
// Merge: optimistic overrides take precedence over server values.
134143
const displayValues = useMemo<SignalSourceValues>(() => {
135144
if (Object.keys(optimistic).length === 0) return serverValues;
@@ -396,6 +405,7 @@ export function useSignalSourceManager() {
396405
return {
397406
displayValues,
398407
sourceStates,
408+
sessionAnalysisStatus,
399409
setupSource,
400410
isLoading,
401411
handleToggle,

apps/code/src/renderer/features/settings/components/sections/SignalSourcesSettings.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export function SignalSourcesSettings() {
77
const {
88
displayValues,
99
sourceStates,
10+
sessionAnalysisStatus,
1011
setupSource,
1112
isLoading,
1213
handleToggle,
@@ -44,6 +45,7 @@ export function SignalSourcesSettings() {
4445
value={displayValues}
4546
onToggle={(source, enabled) => void handleToggle(source, enabled)}
4647
sourceStates={sourceStates}
48+
sessionAnalysisStatus={sessionAnalysisStatus}
4749
onSetup={handleSetup}
4850
evaluations={evaluations}
4951
evaluationsUrl={evaluationsUrl}

0 commit comments

Comments
 (0)