Disable fix ai error button if streaming (#221)

Fixes https://github.com/dyad-sh/dyad/issues/215
This commit is contained in:
Will Chen
2025-05-21 17:21:38 -07:00
committed by GitHub
parent 4931a12d32
commit 731eef1b32

View File

@@ -38,7 +38,7 @@ interface ErrorBannerProps {
const ErrorBanner = ({ error, onDismiss, onAIFix }: ErrorBannerProps) => { const ErrorBanner = ({ error, onDismiss, onAIFix }: ErrorBannerProps) => {
const [isCollapsed, setIsCollapsed] = useState(true); const [isCollapsed, setIsCollapsed] = useState(true);
const { isStreaming } = useStreamChat();
if (!error) return null; if (!error) return null;
const getTruncatedError = () => { const getTruncatedError = () => {
@@ -92,8 +92,9 @@ const ErrorBanner = ({ error, onDismiss, onAIFix }: ErrorBannerProps) => {
{/* AI Fix button at the bottom */} {/* AI Fix button at the bottom */}
<div className="mt-2 flex justify-end"> <div className="mt-2 flex justify-end">
<button <button
disabled={isStreaming}
onClick={onAIFix} onClick={onAIFix}
className="cursor-pointer flex items-center space-x-1 px-2 py-0.5 bg-red-500 dark:bg-red-600 text-white rounded text-sm hover:bg-red-600 dark:hover:bg-red-700" className="cursor-pointer flex items-center space-x-1 px-2 py-0.5 bg-red-500 dark:bg-red-600 text-white rounded text-sm hover:bg-red-600 dark:hover:bg-red-700 disabled:opacity-50 disabled:cursor-not-allowed"
> >
<Sparkles size={14} /> <Sparkles size={14} />
<span>Fix error with AI</span> <span>Fix error with AI</span>