apply_tab_moved

Function apply_tab_moved 

Source
fn apply_tab_moved(
    wstore: &WaveStore,
    tab_id: &str,
    src_workspace_id: &str,
    dst_workspace_id: &str,
    dst_index: u32,
    new_src_active_tab_id: Option<&str>,
    new_dst_active_tab_id: Option<&str>,
) -> Result<(), Box<dyn Error>>
Expand description

Phase E.5.5 — apply a TabMoved event to SQLite. Idempotent: detects already-moved state (tab in dst, not in src) and returns Ok(()) without re-mutating.

What this writes:

  • Removes tab_id from src_workspace.tabids (and pinnedtabids for legacy rows — bootstrap merges them into reducer state, so any leftover here is a stray legacy entry that should be drained).
  • Updates src_workspace.activetabid to new_src_active_tab_id (which may be empty when the source emptied).
  • Inserts tab_id at dst_index in dst_workspace.tabids, clamping to the dst list length.
  • Updates the Tab row’s parent ref so loaders find it under the new workspace.