This commit is contained in:
Timothy Jaeryang Baek
2026-06-06 01:15:16 -04:00
Unverified
parent d21a3bcf86
commit cfc99b228b
@@ -181,13 +181,16 @@
async function loadChat(id: string) {
chatId = id;
loading = true;
// Only show loading spinner on initial load (no messages yet).
// On reloads (e.g. after cancel), keep the DOM intact to preserve scroll position.
const isInitialLoad = allMessages.length === 0;
if (isInitialLoad) loading = true;
try {
const data = await getChat(id);
allMessages = data.messages;
currentMessageId = data.chat.current_message_id;
} finally {
loading = false;
if (isInitialLoad) loading = false;
}
}