Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,21 @@ export function ChatPageContent(props: {
return;
}
console.error(error);
setMessages((prev) => [
...prev,
{

setMessages((prev) => {
const newMessages = prev.slice(
0,
prev[prev.length - 1]?.type === "presence" ? -1 : undefined,
);

// add error message
newMessages.push({
text: `Error: ${error instanceof Error ? error.message : "Failed to execute command"}`,
type: "error",
},
]);
});

return newMessages;
Comment on lines +252 to +258
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still would prefer to not mutate the array with push and instead do [...newMessages, {}] but it's a nitpick at this point so ship it

});
} finally {
setIsChatStreaming(false);
}
Expand Down
Loading