Skip to content

Commit

Permalink
fix issue with response to query (#4266)
Browse files Browse the repository at this point in the history
  • Loading branch information
olusegz07 authored Feb 12, 2025
1 parent c2425bd commit 37ca56d
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -484,12 +484,18 @@ export class QueryManagementContainerComponent implements OnInit, OnDestroy {
let filteredMessages = [];

// Work Allocation uses the id of the query, we require the parentId to filter the messages
if (this.queryCreateContext === QueryCreateContext.RESPOND && allMessages.length > 1) {
if (this.queryCreateContext === QueryCreateContext.RESPOND) {
const parentId = allMessages.find((message) => message.value.id === messageId)?.value.parentId;
// Use parentId as the filter
filteredMessages = allMessages.filter((message) => message.value.id === parentId);

if (parentId) {
// If parentId exists, filter messages using it
filteredMessages = allMessages.filter((message) => message.value.id === parentId);
} else {
// If parentId doesn't exist, fallback to messageId
filteredMessages = allMessages.filter((message) => message.value.id === messageId);
}
} else {
// Use messageId as the filter
// Default case: filter messages by messageId
filteredMessages = allMessages.filter((message) => message.value.id === messageId);
}

Expand Down

0 comments on commit 37ca56d

Please sign in to comment.