agent_ui: Clear error message callout when message is edited or added in same thread (#33768)

Currently if error occurs in the agent thread and user updates the same
messages or sends a new message the error callout is still present and
is not cleared. In this PR we are clearing the last error in case user
sends a new messages or resend the previous message after editing.

Before:


https://github.com/user-attachments/assets/44994004-4cf0-45bc-8b69-88546f037372

After:


https://github.com/user-attachments/assets/993a2a63-8295-47d3-bbda-a2669dee2d5f

Release Notes:

- Fix bug in agent panel error callout not getting removed when a
message is edited or new a message is send.
This commit is contained in:
Umesh Yadav 2025-07-03 19:17:26 +05:30 committed by GitHub
parent 42aca4189a
commit b46e961991
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1026,6 +1026,7 @@ impl ActiveThread {
}
}
ThreadEvent::MessageAdded(message_id) => {
self.clear_last_error();
if let Some(rendered_message) = self.thread.update(cx, |thread, cx| {
thread.message(*message_id).map(|message| {
RenderedMessage::from_segments(
@ -1042,6 +1043,7 @@ impl ActiveThread {
cx.notify();
}
ThreadEvent::MessageEdited(message_id) => {
self.clear_last_error();
if let Some(index) = self.messages.iter().position(|id| id == message_id) {
if let Some(rendered_message) = self.thread.update(cx, |thread, cx| {
thread.message(*message_id).map(|message| {