Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ export const Panel = memo(function Panel() {
const { data: workflows = {} } = useWorkflowMap(workspaceId)
const { data: folders = {} } = useFolderMap(workspaceId)
const activeWorkflowId = useWorkflowRegistry((state) => state.activeWorkflowId)
const copilotDraftScopeKey = activeWorkflowId
? `${workspaceId}:copilot:${activeWorkflowId}`
: undefined
const { handleAutoLayout: autoLayoutWithFitView } = useAutoLayout(activeWorkflowId || null)

// Check for locked blocks (disables auto-layout)
Expand Down Expand Up @@ -883,6 +886,7 @@ export const Panel = memo(function Panel() {
</div>

<MothershipChat
key={copilotDraftScopeKey}
className='min-h-0 flex-1'
messages={copilotMessages}
isSending={copilotIsSending}
Expand All @@ -898,6 +902,7 @@ export const Panel = memo(function Panel() {
onCancelQueueEdit={copilotCancelQueueEdit}
userId={session?.user?.id}
chatId={copilotResolvedChatId}
draftScopeKey={copilotDraftScopeKey}
Comment thread
cursor[bot] marked this conversation as resolved.
layout='copilot-view'
Comment on lines +905 to 906

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Draft not swapped on workflow change

When soft-navigating between workflows, draftScopeKey updates in place but Panel/MothershipChat/UserInput are not keyed by workflow, and UserInput only restores drafts on mount while always saving edits to draftScopeKeyRef.current. The previous workflow's text, attachments, and contexts stay in the editor and further edits overwrite the new workflow's stored draft, so drafts leak across workflows until a full remount.

Suggested change
draftScopeKey={copilotDraftScopeKey}
layout='copilot-view'
key={copilotDraftScopeKey}
draftScopeKey={copilotDraftScopeKey}
layout='copilot-view'

/>
</div>
Expand Down
Loading