mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
Remove the long-lived synchronous POST to /session/{id}/message that produced
spurious "Connection Failed" banners on transient network blips; route every
send (normal, streaming-queue follow-up, message refresh) through prompt_async,
whose failure genuinely means not-delivered. Suppress network-kind banners
while SSE is disconnected or reconnecting (the header already shows that state);
session-kind banners still appear and reconcile clears confirmed prompts after
reconnect.
28 lines
848 B
TypeScript
28 lines
848 B
TypeScript
import { ErrorBanner } from '@/components/ui/error-banner'
|
|
import { useSendErrorStore } from '@/stores/sendErrorStore'
|
|
|
|
interface SessionSendErrorBannerProps {
|
|
sessionId: string | undefined
|
|
isConnected: boolean
|
|
isReconnecting: boolean
|
|
}
|
|
|
|
export function SessionSendErrorBanner({ sessionId, isConnected, isReconnecting }: SessionSendErrorBannerProps) {
|
|
const sendError = useSendErrorStore((s) => sessionId ? s.errors[sessionId] : null)
|
|
const clearSendError = useSendErrorStore((s) => s.clearError)
|
|
|
|
if (!sendError || !sessionId) return null
|
|
|
|
if (sendError.kind === 'network' && (!isConnected || isReconnecting)) return null
|
|
|
|
return (
|
|
<ErrorBanner
|
|
title={sendError.title}
|
|
summary={sendError.message}
|
|
detail={sendError.detail}
|
|
onDismiss={() => clearSendError(sessionId)}
|
|
className="mb-2"
|
|
/>
|
|
)
|
|
}
|