Skip to content

A nested view's layout is the root's, per instance, in the root file - #66

Merged
endrix merged 1 commit into
mainfrom
feat/per-instance-layout
Oct 2, 2026
Merged

endrix merged 1 commit into
mainfrom
feat/per-instance-layout

Conversation

@endrix

@endrix endrix commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Phase 4 of docs/proposals/single-editor-hierarchy.md (after #64 and #65).

Navigating in place, a nested workflow is shown as an instance of the editor's root. Its layout was still the workflow's own: one per workflow, in the file that defines it, shared by every parent and every instance.

Per-instance layout

  • With nestedNavigation: 'in-place', now also carried in the storage options, a view at a trail reads its layout from the root file's store under root/<instance path>/<workflow> (layout-target.ts, instanceLayoutFor). Two uses of one workflow can then be laid out differently.
  • Until an instance has a layout of its own, it starts from the workflow's standalone layout, so earlier layouts carry over. It saves under the instance key from then on.
  • Products that open nested files in their own editors are unchanged.

One recorded save target. The load records the layout target on the diagram model (layoutTarget), and every handler that saves a layout reads it through layoutTargetOf: moving a node, change-routing-points, reset routes, reroute (×2), boundary-flow and serpentine layouts, and placing new nodes. These eight sites each recomputed the key from the shown workflow's name. That also meant a hierarchical runtime's per-instance layouts (cal:rootWorkflow) were read per instance but saved per workflow, and this fixes that too. A rename also moves the node in the instance layout.

Tests: per-instance-layout.test.ts (8). It drives the real load path with a recording layout store and checks the instance key in the root file, the fallback order, unchanged behaviour in new-editor mode, and the target the handlers read. All workspaces pass, with neutrality 5/5 and typecheck 5/5.

https://claude.ai/code/session_015VK7fH1c4aKbexnq2QcuKU

Navigating in place, a nested workflow is shown as an instance of the
editor's root. Its layout was still the workflow's own: one per workflow,
in the file that defines it, shared by every parent and every instance.
With `nestedNavigation: 'in-place'` (now also in the storage options), a
view at a trail reads and saves its layout in the root file's store under
`root/<instance path>/<workflow>`, so two uses of a workflow can be laid
out differently; until it has one it starts from the workflow's
standalone layout, so earlier layouts carry over.

The layout target is now recorded on the diagram model at load and read by
every handler that saves a layout (`layoutTargetOf`). Eight of them --
moving a node, rerouting, resetting routes, the layout commands, placing
new nodes -- recomputed the key from the shown workflow's name, so a
hierarchical runtime's per-instance layouts were read per instance and
saved per workflow. A rename also moves the node in the instance layout.

Phase 4 of docs/proposals/single-editor-hierarchy.md.

Claude-Session: https://claude.ai/code/session_015VK7fH1c4aKbexnq2QcuKU
@endrix
endrix merged commit 9243e6b into main Oct 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant