Skip to content

Commit 3d7c8a4

Browse files
ralyodioclaude
andcommitted
fix: regenerate lockfile with pinned pnpm 9.15.0; mobile agent roster tolerates payloads without participants
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent cc2f632 commit 3d7c8a4

3 files changed

Lines changed: 17 additions & 5 deletions

File tree

‎apps/mobile/src/hooks/useSessionAgents.test.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,9 @@ describe('liveAgents', () => {
2727
];
2828
expect(liveAgents(rows).map((p) => p.id)).toEqual(['agent']);
2929
});
30+
31+
it('treats a session payload without a roster as no agents', () => {
32+
expect(liveAgents(undefined)).toEqual([]);
33+
expect(liveAgents(null)).toEqual([]);
34+
});
3035
});

‎apps/mobile/src/hooks/useSessionAgents.ts‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,20 @@ import { sessionApi } from '@/lib/api/sessions';
1212

1313
export const AGENT_POLL_MS = 10_000;
1414

15-
export function liveAgents(participants: SessionParticipant[]): SessionParticipant[] {
16-
return participants.filter((p) => p.kind === 'agent' && !p.left_at);
15+
export function liveAgents(
16+
participants: SessionParticipant[] | null | undefined
17+
): SessionParticipant[] {
18+
return (participants ?? []).filter((p) => p.kind === 'agent' && !p.left_at);
1719
}
1820

1921
export function useSessionAgents({ sessionId, enabled }: { sessionId: string; enabled: boolean }) {
2022
const [agents, setAgents] = useState<SessionParticipant[]>([]);
2123

2224
const refresh = useCallback(async () => {
2325
if (!sessionId) return;
24-
const result = await sessionApi.get(sessionId);
25-
if (result.data) setAgents(liveAgents(result.data.session_participants));
26+
// The roster is a nicety on top of the session: never let it throw.
27+
const result = await sessionApi.get(sessionId).catch(() => null);
28+
if (result?.data) setAgents(liveAgents(result.data.session_participants));
2629
}, [sessionId]);
2730

2831
useEffect(() => {

‎pnpm-lock.yaml‎

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)