fix: task lane no longer self-hides on submit

TaskLane had `if (submitted) return null` which immediately hid the
component after submit, before the AI could respond. Now the parent
controls visibility: the lane stays visible during the AI call, then
either updates with new tasks or clears when the AI sends none.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-03-28 03:05:58 +00:00
parent e8dfc84717
commit 6268aa3520
2 changed files with 9 additions and 6 deletions

View File

@@ -50,7 +50,6 @@ export function TaskLane({ questions, actions, onSubmit, onClose, loading }: Tas
})), })),
]) ])
const [submitting, setSubmitting] = useState(false) const [submitting, setSubmitting] = useState(false)
const [submitted, setSubmitted] = useState(false)
const [showRunAll, setShowRunAll] = useState(false) const [showRunAll, setShowRunAll] = useState(false)
const [showPreview, setShowPreview] = useState(false) const [showPreview, setShowPreview] = useState(false)
@@ -112,7 +111,6 @@ export function TaskLane({ questions, actions, onSubmit, onClose, loading }: Tas
type: 'action', label: a.label, command: a.command, description: a.description, state: 'pending', value: '', type: 'action', label: a.label, command: a.command, description: a.description, state: 'pending', value: '',
})), })),
]) ])
setSubmitted(false)
}, [questions, actions]) }, [questions, actions])
const updateTask = (idx: number, updates: Partial<TaskResponse>) => { const updateTask = (idx: number, updates: Partial<TaskResponse>) => {
@@ -164,12 +162,12 @@ export function TaskLane({ questions, actions, onSubmit, onClose, loading }: Tas
const handleSubmit = () => { const handleSubmit = () => {
setSubmitting(true) setSubmitting(true)
onSubmit(tasks) onSubmit(tasks)
setSubmitted(true) // Don't self-hide — parent controls visibility via showTaskLane.
// The AI response will either send updated tasks (replacing these)
// or send none (parent hides the lane).
setSubmitting(false) setSubmitting(false)
} }
if (submitted) return null
return ( return (
<div <div
className="relative bg-sidebar border-l border-default flex flex-col shrink-0 animate-in slide-in-from-right-4 duration-200" className="relative bg-sidebar border-l border-default flex flex-col shrink-0 animate-in slide-in-from-right-4 duration-200"

View File

@@ -310,13 +310,18 @@ export default function AssistantChatPage() {
if (response.fork && activeChatId) { if (response.fork && activeChatId) {
branching.loadBranches(activeChatId) branching.loadBranches(activeChatId)
} }
// Show task lane again if AI sends more tasks // Update task lane based on AI response
const hasQuestions = response.questions && response.questions.length > 0 const hasQuestions = response.questions && response.questions.length > 0
const hasActions = response.actions && response.actions.length > 0 const hasActions = response.actions && response.actions.length > 0
if (hasQuestions || hasActions) { if (hasQuestions || hasActions) {
setActiveQuestions(response.questions || []) setActiveQuestions(response.questions || [])
setActiveActions(response.actions || []) setActiveActions(response.actions || [])
setShowTaskLane(true) setShowTaskLane(true)
} else {
// AI sent no new tasks — clear the lane
setShowTaskLane(false)
setActiveQuestions([])
setActiveActions([])
} }
} catch { } catch {
setMessages(prev => [ setMessages(prev => [