Skip to main content

apply_layout_tree_replaced

Function apply_layout_tree_replaced 

Source
fn apply_layout_tree_replaced(
    mstore: &Store,
    tab_id: &str,
    new_tree: &Option<LayoutNode>,
    slices: Option<&LayoutClientSlices>,
) -> Result<(), Box<dyn Error>>
Expand description

Phase E.4.B — apply a LayoutTreeReplaced event: write the reducer- supplied tree onto LayoutState.rootnode. Mirrors reducer::layout::handle_layout_set_tree — when the new tree is empty, also clear the focus/magnify ids (and leaforder) so they don’t dangle at nodes that no longer exist.

SPEC_864 Phase 2 — when the event carries slices (the UpdateObject→LayoutSetTree full-row push), the frontend-owned columns are REPLACED to mirror the legacy update_raw whole-row write this route retires: leaforder / pendingbackendactions are written verbatim (absent = clear — pushing without processed actions is how the frontend acks its queue); focus/magnify strings overwrite (empty = clear). slices: None (granular events, tree-only callers) leaves those columns untouched — leaforder is a frontend-recomputed geometry cache (getLeafOrder in layoutGeometry.ts) and is NOT read on reproject (persist::bootstrap_state_from_mstore reads rootnode/focus/magnify only). Idempotent: no-op (no version bump) when nothing changes.