fix: simplify message loading guards

This commit is contained in:
Bohdan Triapitsyn
2026-02-10 01:37:37 +02:00
parent b727f16b80
commit 0a47bc058c
2 changed files with 10 additions and 8 deletions
@@ -151,9 +151,7 @@ export const ChatContainer: React.FC = () => {
} }
const hasSessionMessages = messages.has(currentSessionId); const hasSessionMessages = messages.has(currentSessionId);
const existingMessages = hasSessionMessages ? messages.get(currentSessionId) ?? [] : []; if (hasSessionMessages) {
if (existingMessages.length > 0) {
return; return;
} }
@@ -272,11 +272,15 @@ export const VSCodeLayout: React.FC = () => {
return; return;
} }
const hasMessages = messages.has(currentSessionId) && (messages.get(currentSessionId)?.length || 0) > 0; const hasMessagesEntry = messages.has(currentSessionId);
if (!hasMessages) { if (hasMessagesEntry) {
try { return;
await loadMessages(currentSessionId); }
} catch { /* ignored */ }
try {
await loadMessages(currentSessionId);
} catch {
/* ignored */
} }
}; };