-
Notifications
You must be signed in to change notification settings - Fork 464
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Background
Currently, the workflow state is duplicated in two places:
nodes/edgesin workflow-store - Updated when canvas changesactiveWorkflowin workflow-store - Updated only at specific points (load, open panel, AI success)
This dual-state architecture has caused synchronization issues:
- AI Refinement: Conversation history disappears when collapsing panel #384 - Conversation history not synced between refinement-store and activeWorkflow (fixed)
- AI Refinement: Canvas changes while panel is open are not reflected in AI context #388 - Canvas changes not reflected in activeWorkflow (fixed with sync useEffect)
Current State (After #384 and #388)
Both issues are fixed by adding useEffect hooks that sync:
refinementStore.conversationHistory→activeWorkflow.conversationHistorynodes/edges→activeWorkflow
While functional, this approach maintains two sources of truth with synchronization logic.
Proposed Refactoring
Remove activeWorkflow entirely and use nodes/edges as the single source of truth:
Changes Required
- Remove
activeWorkflowfrom workflow-store - Add missing metadata fields to the store:
workflowId(currently only in activeWorkflow)workflowVersion(currently only in activeWorkflow)workflowCreatedAt/workflowUpdatedAt(currently only in activeWorkflow)
- Update all consumers (7 files, 65 occurrences):
App.tsxToolbar.tsxRefinementChatPanel.tsxDescriptionPanel.tsxSubAgentFlowDialog.tsxSlackShareDialog.tsxworkflow-store.ts
- Serialize workflow on-demand when needed (save, export, AI refinement)
Benefits
- Single source of truth
- No synchronization issues
- Simpler mental model
- Reduced risk of stale data bugs
Considerations
- Larger refactoring effort (~65 occurrences)
- Need to ensure all metadata is preserved
- May require migration logic for existing workflows
Priority
Low - The current sync approach works correctly. This is a code quality improvement.
Related
- AI Refinement: Conversation history disappears when collapsing panel #384 - Conversation history sync (fixed)
- fix: sync conversation history to workflow-store on every change #387 - PR that fixed AI Refinement: Conversation history disappears when collapsing panel #384
- AI Refinement: Canvas changes while panel is open are not reflected in AI context #388 - Canvas changes sync (fixed)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request