Skip to content

Commit

Permalink
Reapply check before clearing thread events
Browse files Browse the repository at this point in the history
  • Loading branch information
hpeebles committed Dec 28, 2023
1 parent 8594d2a commit 7a6118c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions frontend/openchat-client/src/openchat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand Down

0 comments on commit 7a6118c

Please sign in to comment.