Skip to main content

queue_source_layout_delete

Function queue_source_layout_delete 

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

Phase E.5.5 — append a layout-delete action to the source tab’s LayoutState.pendingbackendactions so the source window’s frontend tears the moved block out of its layout tree on next poll. Used by the TearOffBlock/PromoteBlockToTab/RedockFloatingPane RPC handlers (the wcore-direct tear_off_block this used to mirror was dead code, deleted in SPEC_864 Phase 5).

Also used by sagas::delete_block (pub(crate), not pub(super), for that reason) — a direct LayoutDeleteNodeByBlock reducer dispatch prunes db_layout correctly but, per this function’s own “why this and not direct writes” doc above, does nothing to tell a frontend that already has the tab’s tree loaded. Without this call too, that frontend’s next unrelated edit in the tab re-pushes its stale copy — still containing the just-deleted block’s leaf — and silently resurrects it as a dangling reference (empty/dead pane; see INVESTIGATION_LAYOUT_DEAD_SPACE_STALE_TREE_RESURRECTION_2026_07_08.md).