Skip to content

Commit 48bc44a

Browse files
cursoragentmsukkari
andcommitted
fix(web): auto-hide error banner when chat error is cleared
The error banner visibility was only set to true when an error occurred, but was never automatically hidden when the error state was cleared. This caused stale 'Network error' banners to persist even after a new request started successfully. Now the banner visibility is properly synchronized with the error state: - When error is truthy: banner is visible - When error is falsy: banner is hidden This ensures that benign transient errors that get cleared by the AI SDK (e.g. when a new request starts) no longer leave lingering error banners. Fixes SOU-2018 Co-authored-by: Michael Sukkarieh <msukkari@users.noreply.github.com>
1 parent 3f98f44 commit 48bc44a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

packages/web/src/ee/features/chat/components/chatThread/chatThread.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,11 +420,11 @@ export const ChatThread = ({
420420
}, [scrollRef]);
421421

422422

423-
// Keep the error state & banner visibility in sync.
423+
// Keep the error state & banner visibility in sync. The banner should
424+
// automatically hide when the error is cleared (e.g. when a new request
425+
// starts successfully), preventing stale error banners from lingering.
424426
useEffect(() => {
425-
if (error) {
426-
setIsErrorBannerVisible(true);
427-
}
427+
setIsErrorBannerVisible(!!error);
428428
}, [error]);
429429

430430
const onSubmit = useCallback(async (children: Descendant[], editor: CustomEditor, attachments: AttachmentData[]) => {

0 commit comments

Comments
 (0)