diff --git a/frontend/src/lib/components/graph/FlowGraphV2.svelte b/frontend/src/lib/components/graph/FlowGraphV2.svelte index 47f6905148..15851b812c 100644 --- a/frontend/src/lib/components/graph/FlowGraphV2.svelte +++ b/frontend/src/lib/components/graph/FlowGraphV2.svelte @@ -251,8 +251,8 @@ movingIds = undefined }: Props = $props() - // Runtime state for expanded containers (collapsed by default) - let expandedContainers = $state>(new Set()) + // Runtime state for collapsed containers (expanded by default) + let collapsedContainers = $state>(new Set()) // Initialize note manager with fine-grained reactivity const noteManager = new NoteManager( @@ -438,10 +438,10 @@ groupEditorContext?.groupEditor.expandGroup(groupId) }, expandContainer: (moduleId: string) => { - expandedContainers = new Set([...expandedContainers, moduleId]) + collapsedContainers = new Set([...collapsedContainers].filter((id) => id !== moduleId)) }, collapseContainer: (moduleId: string) => { - expandedContainers = new Set([...expandedContainers].filter((id) => id !== moduleId)) + collapsedContainers = new Set([...collapsedContainers, moduleId]) }, updateMock: (detail) => { onUpdateMock?.(detail) @@ -852,7 +852,7 @@ triggerNode ? path : undefined, expandedSubflows, collapsedGroups, - expandedContainers, + collapsedContainers, showNotes ) }) diff --git a/frontend/src/lib/components/graph/graphBuilder.svelte.ts b/frontend/src/lib/components/graph/graphBuilder.svelte.ts index 10c05abe13..1a0d52a0d4 100644 --- a/frontend/src/lib/components/graph/graphBuilder.svelte.ts +++ b/frontend/src/lib/components/graph/graphBuilder.svelte.ts @@ -412,7 +412,7 @@ export function graphBuilder( collapsed?: boolean module_ids: string[] }>, - expandedContainers: Set, + collapsedContainers: Set, showNotes: boolean // triggerProps?: { // path?: string @@ -738,7 +738,7 @@ export function graphBuilder( module.value.type === 'branchone' || module.value.type === 'forloopflow' || module.value.type === 'whileloopflow' - if (isContainer && !expandedContainers.has(module.id)) { + if (isContainer && collapsedContainers.has(module.id)) { const containerModules = getContainerModules(module) addNode(module, { isCollapsedContainer: true, containerModules })