Skip to Content
InternalsSubtree Replacement

Subtree Replacement

Ansiq does not currently implement full keyed virtual DOM reconciliation.

Instead it takes a more pragmatic route:

  • identify dirty component scopes
  • rerender only those subtrees
  • replace old subtrees with new ones
  • run partial relayout and redraw after that

Why this route was chosen

Ansiq started from terminal UI constraints, not from the browser DOM.

In terminal applications, the main priorities are:

  • avoiding global rebuild work
  • preserving interactive state
  • minimizing redraw and patch emission

For that context, mature subtree replacement is more valuable than prematurely building a full reconciliation engine.

The cost of this choice

The cost is also clear:

  • continuity state becomes mandatory
  • subtree boundaries must stay clear
  • relayout and damage rules must be tightened

Without those, subtree replacement becomes a confusing half-measure.

Where to go next

Continue with:

  1. Continuity Contract
  2. Partial Relayout and Damage Model
  3. Runtime Loop
Last updated on