Skip to main content

queue_layout_actions_via_reducer

Function queue_layout_actions_via_reducer 

Source
pub(crate) async fn queue_layout_actions_via_reducer(
    state: &AppState,
    tab_id: &str,
    actions: Vec<LayoutActionData>,
) -> Result<(), String>
Expand description

SPEC_864 Phase 4 — single-writer queue append. Dispatch a LayoutQueueBackendActions and persist the resulting LayoutBackendActionsQueued inside ONE hold of the reducer mutex (same critical-section contract as seed_layout_via_reducer), so a concurrent frontend ACK slice (LayoutSetTree REPLACE) can’t interleave between dispatch and persist. Replaces the five store-direct pendingbackendactions writers (layout_helpers’ insert/split/delete queuers + the two inline app_api sites).

No rollback arm: the reducer does not model the queue in TabRecord (pass-through validation only), so a SQLite apply failure leaves no reducer↔SQLite divergence to repair — just return the error.

actions must be non-empty; the reducer rejects an empty array.