From 7a6118c6778b5ab47840c293ac184e6726d25e69 Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Thu, 28 Dec 2023 12:20:05 +0000 Subject: [PATCH] Reapply check before clearing thread events --- frontend/openchat-client/src/openchat.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/openchat-client/src/openchat.ts b/frontend/openchat-client/src/openchat.ts index 5335043a98..10e661e0e2 100644 --- a/frontend/openchat-client/src/openchat.ts +++ b/frontend/openchat-client/src/openchat.ts @@ -2351,8 +2351,6 @@ export class OpenChat extends OpenChatAgentWorker { const context = { chatId, threadRootMessageIndex }; - if (!messageContextsEqual(context, this._liveState.selectedMessageContext)) return; - const eventsResponse = await this.sendRequest({ kind: "chatEvents", chatType: chat.kind, @@ -2365,7 +2363,10 @@ export class OpenChat extends OpenChatAgentWorker { }); if (eventsResponse !== undefined && eventsResponse !== "events_failed") { - if (clearEvents) { + if ( + clearEvents && + messageContextsEqual(context, this._liveState.selectedMessageContext) + ) { threadServerEventsStore.set([]); } await this.handleThreadEventsResponse(chatId, threadRootMessageIndex, eventsResponse);