Fix BranchToolbar errors silently dropped for draft threads

Route errors through onError callback prop so draft thread errors
are handled via ChatView's setThreadError, which correctly updates
localDraftErrorsByThreadId instead of dispatching SET_ERROR that
silently no-ops for threads not in state.threads.

Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
Cursor AgentandJulius Marminge committed 2026-03-02 06:44:05 +00:00
1 parent 9e99b8efdc
commit d497cd72f7
2 files changed
+8 -1

No files matched your search

+7 -1
View File
@@ -34,6 +34,7 @@ interface BranchToolbarProps {
onEnvModeChange: (mode: "local" | "worktree") => void;
envLocked: boolean;
onComposerFocusRequest?: () => void;
onError?: (error: string | null) => void;
}
export default function BranchToolbar({
@@ -42,6 +43,7 @@ export default function BranchToolbar({
onEnvModeChange,
envLocked,
onComposerFocusRequest,
onError,
}: BranchToolbarProps) {
const { state, dispatch } = useStore();
const draftThread = useComposerDraftStore((store) => store.getDraftThread(threadId));
@@ -147,7 +149,11 @@ export default function BranchToolbar({
const setThreadError = (error: string | null) => {
if (!activeThreadId) return;
dispatch({ type: "SET_ERROR", threadId: activeThreadId, error });
if (hasServerThread) {
dispatch({ type: "SET_ERROR", threadId: activeThreadId, error });
} else {
onError?.(error);
}
};
const setThreadBranch = (branch: string | null, worktreePath: string | null) => {
+1
View File
@@ -2463,6 +2463,7 @@ export default function ChatView({ threadId }: ChatViewProps) {
onEnvModeChange={onEnvModeChange}
envLocked={envLocked}
onComposerFocusRequest={scheduleComposerFocus}
onError={(error) => setThreadError(activeThread.id, error)}
/>
)}