Skip to content

Commit 35ba0a7

Browse files
authored
Fix reconnection transcript behavior (#94)
1 parent 0b0a3c6 commit 35ba0a7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Sources/Core/Service/ChatService.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,13 @@ class ChatService : ChatServiceProtocol {
818818

819819
if let websocketManager = self?.websocketManager {
820820
let formattedItems = websocketManager.formatAndProcessTranscriptItems(transcriptItems)
821-
self?.triggerTranscriptListUpdate()
821+
822+
// Dispatch the transcript list update to the next run loop cycle
823+
// to ensure formatAndProcessTranscriptItems completes all its internal processing
824+
DispatchQueue.main.async {
825+
self?.triggerTranscriptListUpdate()
826+
}
827+
822828
let transcriptResponse = TranscriptResponse(
823829
initialContactId: response.initialContactId ?? "",
824830
nextToken: response.nextToken ?? "", // Handle nextToken if it is available in the response

0 commit comments

Comments
 (0)