fix(web): add dismiss button to thread error banner (#588)
The thread error banner had no way to be dismissed. Users hitting unrecoverable errors (e.g. missing gh CLI during PR creation) were stuck with a persistent error banner and no way to clear it. Add a dismiss (X) button to ThreadErrorBanner using the existing AlertAction component, wired to clear the thread error via setThreadError(id, null). Closes #496
This commit is contained in:
1 parent
17942787aa
commit
59e2944fb7
1 file changed
+24
-3
@@ -123,7 +123,7 @@ import {
|
||||
} from "../keybindings";
|
||||
import ChatMarkdown from "./ChatMarkdown";
|
||||
import ThreadTerminalDrawer from "./ThreadTerminalDrawer";
|
||||
import { Alert, AlertDescription, AlertTitle } from "./ui/alert";
|
||||
import { Alert, AlertAction, AlertDescription, AlertTitle } from "./ui/alert";
|
||||
import {
|
||||
BotIcon,
|
||||
ChevronDownIcon,
|
||||
@@ -3434,7 +3434,10 @@ export default function ChatView({ threadId }: ChatViewProps) {
|
||||
|
||||
{/* Error banner */}
|
||||
<ProviderHealthBanner status={activeProviderStatus} />
|
||||
<ThreadErrorBanner error={activeThread.error} />
|
||||
<ThreadErrorBanner
|
||||
error={activeThread.error}
|
||||
onDismiss={() => setThreadError(activeThread.id, null)}
|
||||
/>
|
||||
<PlanModePanel activePlan={activePlan} />
|
||||
|
||||
{/* Messages */}
|
||||
@@ -4095,7 +4098,13 @@ const ChatHeader = memo(function ChatHeader({
|
||||
);
|
||||
});
|
||||
|
||||
const ThreadErrorBanner = memo(function ThreadErrorBanner({ error }: { error: string | null }) {
|
||||
const ThreadErrorBanner = memo(function ThreadErrorBanner({
|
||||
error,
|
||||
onDismiss,
|
||||
}: {
|
||||
error: string | null;
|
||||
onDismiss?: () => void;
|
||||
}) {
|
||||
if (!error) return null;
|
||||
return (
|
||||
<div className="pt-3 mx-auto max-w-3xl">
|
||||
@@ -4104,6 +4113,18 @@ const ThreadErrorBanner = memo(function ThreadErrorBanner({ error }: { error: st
|
||||
<AlertDescription className="line-clamp-3" title={error}>
|
||||
{error}
|
||||
</AlertDescription>
|
||||
{onDismiss && (
|
||||
<AlertAction>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Dismiss error"
|
||||
className="inline-flex size-6 items-center justify-center rounded-md text-destructive/60 transition-colors hover:text-destructive"
|
||||
onClick={onDismiss}
|
||||
>
|
||||
<XIcon className="size-3.5" />
|
||||
</button>
|
||||
</AlertAction>
|
||||
)}
|
||||
</Alert>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user