diff --git a/frontend/openchat-client/src/stores/dataByMessageContextFactory.ts b/frontend/openchat-client/src/stores/dataByMessageContextFactory.ts index bf38773911..39c1c45926 100644 --- a/frontend/openchat-client/src/stores/dataByMessageContextFactory.ts +++ b/frontend/openchat-client/src/stores/dataByMessageContextFactory.ts @@ -48,5 +48,6 @@ export function createMessageContextSpecificObjectStore(init: () => T) { }, clear: (newValue?: MessageContextMap): void => store.set(newValue ?? new MessageContextMap()), + size: (): number => storeValue.size, }; } diff --git a/frontend/openchat-client/src/stores/failedMessages.ts b/frontend/openchat-client/src/stores/failedMessages.ts index 95a39b889b..cc38e75d89 100644 --- a/frontend/openchat-client/src/stores/failedMessages.ts +++ b/frontend/openchat-client/src/stores/failedMessages.ts @@ -25,6 +25,7 @@ function createFailedMessagesStore() { })); }, contains: (key: MessageContext, messageId: bigint): boolean => { + if (store.size() === 0) return false; const chatState = store.get(key); return chatState ? chatState[messageId.toString()] !== undefined : false; },