pub(crate) async fn restore_active_tab(
state: &AppState,
ws_id: &str,
snapshot: &Value,
new_tab_ids_by_snapshot_index: &HashMap<usize, String>,
) -> Vec<Event>Expand description
Make the snapshot’s active tab (active_tab_index, a position in its
tabs) the workspace’s active tab, given the new ids of the tabs that came
back by that position. Returns the applied events, unpublished.
Restore which tab was active (reagentx P2 on PR #2560: previously
never captured/restored at all — every relaunch focused whichever tab
CreateTab’s own first-tab-wins default (wcore/tab.rs) happened to
leave active, i.e. always the first). None (no index in the
snapshot, or that index’s tab didn’t survive restore) leaves that
default in place rather than erroring — an unset/stale active tab is
a cosmetic miss, not a reason to fail the whole restore.