Skip to main content

setup_torn_off_block_layout

Function setup_torn_off_block_layout 

Source
pub(crate) async fn setup_torn_off_block_layout(
    state: &AppState,
    new_tab_id: &str,
    block_id: &str,
) -> Result<(), String>
Expand description

Phase E.5.5 — set up the layout tree for a tab that just received its first block via the TearOffBlock saga. Called from the TearOffBlock / PromoteBlockToTab handlers and the floating pane.open path after the saga’s reducer-state portion (CreateTab + MoveBlock) completes. (NOT RedockFloatingPane — that redocks into an EXISTING tab and goes through queue_target_layout_insert/_split instead; reagent P2 on #1971.)

SPEC_864 Phase 3 — reducer-routed: dispatches LayoutSetTree via seed_layout_via_reducer (single writer of db_layout; the reducer’s TabRecord.rootnode stays authoritative) instead of the retired wcore-direct rootnode/leaforder write. Every caller runs post-saga, so the tab is always reducer-known. Best-effort at the call sites: a failure leaves the new tab with the moved block but a malformed layout; the user-visible symptom is an empty render in the new window.