Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix: isolate panel state between SubAgentFlowDialog and main canvas#323

Merged
breaking-brake merged 2 commits intomainbreaking-brake/cc-wf-studio:mainfrom
fix/subagent-flow-panel-state-isolationbreaking-brake/cc-wf-studio:fix/subagent-flow-panel-state-isolationCopy head branch name to clipboard
Dec 23, 2025
Merged

fix: isolate panel state between SubAgentFlowDialog and main canvas#323
breaking-brake merged 2 commits intomainbreaking-brake/cc-wf-studio:mainfrom
fix/subagent-flow-panel-state-isolationbreaking-brake/cc-wf-studio:fix/subagent-flow-panel-state-isolationCopy head branch name to clipboard

Conversation

@breaking-brake
Copy link
Copy Markdown
Owner

Problem

SubAgentFlowDialog panels were not properly isolated from the main workflow canvas:

Issue 1: Panel Display Synchronization

When opening PropertyOverlay or RefinementChatPanel in SubAgentFlowDialog, they would also open on the main canvas due to shared global state.

Issue 2: Chat History Synchronization

AI editing chat history in SubAgentFlowDialog was synced with main workflow. Opening AI editing in SubAgentFlow would overwrite the main workflow's conversation history in the global refinement store.

Issue 3: Send Button Not Working

In SubAgentFlowDialog, clicking the send button in AI editing did nothing unless the main workflow's AI editing chat had been opened first. This was because activeWorkflow was null for manually created workflows.

Solution

Panel State Isolation

  • Added local state (localSelectedNodeId, isLocalPropertyOverlayOpen, isLocalRefinementPanelOpen) to SubAgentFlowDialog
  • Passed overrideSelectedNodeId prop to PropertyOverlay for local control

Chat History Isolation (Controlled Component Pattern)

  • Created RefinementChatState type for shared state interface
  • Created useLocalRefinementChatState hook for local chat state management (~230 lines)
  • Refactored RefinementChatPanel to be a controlled component accepting chatState props
  • SubAgentFlowDialog manages its own chat state locally via the hook
  • App.tsx builds mainChatState from the existing refinement store

activeWorkflow Initialization

  • Added ensureActiveWorkflow() function to workflow-store
  • Called in handleToggleAiEditMode to ensure activeWorkflow exists before AI editing
  • Creates workflow from canvas state if null (handles manually created workflows)

Changes

New Files

  • src/webview/src/types/refinement-chat-state.ts - Shared state type definition
  • src/webview/src/hooks/useLocalRefinementChatState.ts - Local chat state hook

Modified Files

  • SubAgentFlowDialog.tsx - Local panel state + hook usage + ensureActiveWorkflow call
  • PropertyOverlay.tsx - Added overrideSelectedNodeId prop support
  • RefinementChatPanel.tsx - Controlled component with chatState prop
  • MessageList.tsx / MessageInput.tsx - Controlled mode support
  • App.tsx - Build mainChatState from refinement store
  • workflow-store.ts - Added ensureActiveWorkflow function

Impact

  • SubAgentFlowDialog panels now operate independently from main canvas
  • AI editing chat history is isolated per context (main vs SubAgentFlow)
  • Manually created workflows can now use AI editing in SubAgentFlow
  • No breaking changes to existing functionality

Testing

  • Manual E2E testing completed
  • Code quality checks passed (format, lint, build)

🤖 Generated with Claude Code

breaking-brake and others added 2 commits December 23, 2025 12:10
- Add local state management for PropertyOverlay and RefinementChatPanel in SubAgentFlowDialog
- Add overrideSelectedNodeId and onClose props to PropertyOverlay component
- Reset local panel state when dialog closes
- Prevents duplicate panel display when selecting nodes in SubAgentFlowDialog

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add RefinementChatState type for controlled component pattern
- Add useLocalRefinementChatState hook for local chat state management
- Make RefinementChatPanel a controlled component accepting chatState props
- Add ensureActiveWorkflow to handle manually created workflows
- Fixes issue where SubAgentFlow AI editing synced with main workflow

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@breaking-brake breaking-brake merged commit a1c9d7e into main Dec 23, 2025
3 checks passed
@breaking-brake breaking-brake deleted the fix/subagent-flow-panel-state-isolation branch December 23, 2025 06:27
@breaking-brake breaking-brake mentioned this pull request Dec 23, 2025
braking-brake-semantic-release Bot pushed a commit that referenced this pull request Dec 23, 2025
## [3.9.1](v3.9.0...v3.9.1) (2025-12-23)

### Bug Fixes

* isolate panel state between SubAgentFlowDialog and main canvas ([#323](#323)) ([a1c9d7e](a1c9d7e))
* resolve dialog z-index stacking issue in SubAgentFlowDialog ([#322](#322)) ([7eb6b0c](7eb6b0c))
* resolve gap between node palette and canvas in compact mode ([#311](#311)) ([8d6ec52](8d6ec52))

### Improvements

* fix tour Load button focus and add Run step ([#312](#312)) ([9ac27ab](9ac27ab))
* refine AI editing panel layout with overlay separation ([#321](#321)) ([9c30e4e](9c30e4e))
@braking-brake-semantic-release
Copy link
Copy Markdown

🎉 This PR is included in version 3.9.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.