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
- Run a parent workflow that calls a sub-workflow via
subWorkflow.run() and saves a LinkDocument with embed: true (e.g. show: 'inline').
- Open the parent workflow in Studio — the embedded child renders inline, expanded.
- 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/core — LinkDocument'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.
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
subWorkflow.run()and saves aLinkDocumentwithembed: true(e.g.show: 'inline').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
@loopstack/loopstack-studioloopstack/frontend/studio/src/components/loopstack-elements/link.tsx(LinkCard, line ~32)loopstack/frontend/studio/src/features/documents/renderers/LinkMessageRenderer.tsxloopstack/packages/core—LinkDocument'sexpandedfield written once at creation, never updatedRoot cause (from investigation)
LinkCardinitializesexpandedfromdefaultExpandedonce and never reacts to prop changes:statusprop is plumbed correctly:LinkMessageRendererusesuseChildWorkflowsand maps state viamapWorkflowStateToStatus. ButLinkCardonly consumesstatusfor icon color (statusColorMap[status], line ~83). No effect reacts tostatusbecomingsuccess/failure.expandedfield onLinkDocumentis set totrueat queue time and never updated when the child completes — so on reload the embed also comes back expanded.Environment
Additional context
Related convention: sub-workflow embedding stores a
LinkDocumentwithembed: trueaftersubWorkflow.run()so Studio renders it inline.