Compare commits

...
Author SHA1 Message Date
Sonarly Claude CodeandClaude Opus 4.6 b0d652fe35 Fix TypeError in timeline messaging when thread has no participants
When a message thread has no participants with role FROM in the
threadParticipantsByThreadId map, the lookup returns undefined which
is passed to extractParticipantSummary -> filterActiveParticipants,
causing "Cannot read properties of undefined (reading 'filter')".

Add nullish coalescing fallback to empty array in formatThreads, and
add early return guard in extractParticipantSummary for empty
participant arrays.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 15:51:19 +00:00
2 changed files with 17 additions and 1 deletions
@@ -13,6 +13,22 @@ export const extractParticipantSummary = (
const activeMessageParticipants =
filterActiveParticipants(messageParticipants);
if (activeMessageParticipants.length === 0) {
return {
firstParticipant: {
personId: null,
workspaceMemberId: null,
firstName: '',
lastName: '',
displayName: '',
avatarUrl: '',
handle: '',
},
lastTwoParticipants: [],
participantCount: 0,
};
}
const firstParticipant = formatThreadParticipant(
activeMessageParticipants[0],
);
@@ -35,7 +35,7 @@ export const formatThreads = (
visibility === MessageChannelVisibility.SHARE_EVERYTHING
? thread.lastMessageBody
: FIELD_RESTRICTED_ADDITIONAL_PERMISSIONS_REQUIRED,
...extractParticipantSummary(threadParticipantsByThreadId[thread.id]),
...extractParticipantSummary(threadParticipantsByThreadId[thread.id] ?? []),
visibility,
read: true,
};