Skip to content

Sub-blocks: collapse a multi-step chain into a nested block #7

Description

@ApocDev

Let me group a sequence of recipes into a collapsible "sub-block" so a long chain (e.g. a metal chain that's 10+ processes ending in plates) can be folded into one line, then expanded when I want the detail.

Why

Blocks are currently flat — each block holds one BlockData with a recipe set, solved as a single linear system (solver/block.ts). There's no notion of a block containing or referencing another block (no parentBlockId/includes in db/schema.ts; cross-block flows are only matched at the factory/coherence layer in db/queries.ts). So a 10-step plate chain is 10 rows with no way to collapse the intermediate steps.

Open design questions (decide before building)

This is a meaty feature; the model matters:

  1. Display-only collapse vs. real composition. Easiest: a sub-block is just a visual grouping of rows within the same block that can be folded — still one solve, one recipe set. Fuller: a sub-block is its own block (own target/solve) that the parent imports from, so the chain is reusable and solved independently.
  2. If real composition: how do parent imports/exports wire to the sub-block's boundary flows? Does the sub-block surface only its final output (plates) and hide intermediates?
  3. Reuse: can the same sub-block be referenced by multiple parents, or is it inline-only?
  4. Interaction with the existing factory-level coherence/seam model.

Recommend starting with the display-only collapse (low risk, immediate value) and treating real nested-solve composition as a follow-up.

Relates to #6 (row reordering — collapse groups would build on row grouping).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: webWeb UI (React/TanStack/vite-plus)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions