Anonymous View
Skip to content

Bug: Embedded sub-workflows don't collapse when finished #213

@jakobklippel

Description

@jakobklippel

Summary

Embedded sub-workflows in Studio stay expanded after the child workflow completes. They should auto-collapse when the child reaches a terminal state (success / failure).

Steps to reproduce

  1. Run a parent workflow that calls a sub-workflow via subWorkflow.run() and saves a LinkDocument with embed: true (e.g. show: 'inline').
  2. Open the parent workflow in Studio — the embedded child renders inline, expanded.
  3. Wait for the sub-workflow to finish.

Expected behaviour

The embedded sub-workflow card auto-collapses on completion. Reloading the page also shows it collapsed.

Actual behaviour

The card stays expanded indefinitely. Reloading still shows it expanded.

Affected area

  • Package: @loopstack/loopstack-studio
  • Files:
    • loopstack/frontend/studio/src/components/loopstack-elements/link.tsx (LinkCard, line ~32)
    • loopstack/frontend/studio/src/features/documents/renderers/LinkMessageRenderer.tsx
    • loopstack/packages/coreLinkDocument's expanded field written once at creation, never updated

Root cause (from investigation)

  • LinkCard initializes expanded from defaultExpanded once and never reacts to prop changes:
    const [expanded, setExpanded] = useState(defaultExpanded ?? false);
  • The live status prop is plumbed correctly: LinkMessageRenderer uses useChildWorkflows and maps state via mapWorkflowStateToStatus. But LinkCard only consumes status for icon color (statusColorMap[status], line ~83). No effect reacts to status becoming success / failure.
  • The persisted expanded field on LinkDocument is set to true at queue time and never updated when the child completes — so on reload the embed also comes back expanded.

Environment

  • Branch / commit: TBD
  • Node / npm / OS: TBD

Additional context

Related convention: sub-workflow embedding stores a LinkDocument with embed: true after subWorkflow.run() so Studio renders it inline.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpriority:p1High priority

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions