fix unreachable error branch in fetchConversation causing silent failures

openapi-fetch returns either `{ data }` or `{ error }`, never both. The previous guard checked `!data` first, so HTTP errors always hit that branch and returned early — the `error` toast was unreachable. Failed conversation loads now surface to the user instead of failing silently.

Co-Authored-By: John Chilton <jmchilton@gmail.com>
This commit is contained in:
Claude
2026-06-01 15:49:26 -05:00
committed by Ahmed Awan
co-authored by John Chilton
parent c308befda3
commit 4af780eb42
+4 -3
View File
@@ -281,12 +281,13 @@ async function fetchConversation(exchangeId: string) {
},
});
if (!fullConversation || fullConversation.length === 0) {
return;
} else if (error) {
if (error) {
Toast.error(errorMessageAsString(error, "Failed to load conversation."), "Error loading conversation");
return;
}
if (!fullConversation || fullConversation.length === 0) {
return;
}
messages.value = fullConversation.map((msg: any, index: number) => {
const message: ChatMessage = {