fix(launcher): preserve local game state after directory changes
The accepted root transition already publishes the replacement local snapshot before the transfer-status fence completes. Clearing local flags again when committing the folder erased that snapshot, and the subsequent ListGames refresh only restored remote availability. Keep the accepted local state. Test Plan: - `just fmt`, `just clippy`, and `just test` -- passed on the full worktree. - `just frontend-test` -- 94 passed on the full worktree. - `git diff --cached --check` -- passed. - GUI directory switching was not exercised interactively.
This commit is contained in:
@@ -2286,12 +2286,6 @@ fn apply_peer_remote_view(
|
||||
}
|
||||
}
|
||||
|
||||
fn clear_all_local_game_states(game_db: &mut GameDB) {
|
||||
for game in game_db.games.values_mut() {
|
||||
clear_local_game_state(game);
|
||||
}
|
||||
}
|
||||
|
||||
fn emit_game_transfer_status_snapshot(
|
||||
app_handle: &AppHandle,
|
||||
snapshot: &GameTransferStatusSnapshot,
|
||||
@@ -3112,10 +3106,10 @@ async fn update_game_directory(
|
||||
reset_game_transfer_status_for_root(&app_handle).await?;
|
||||
}
|
||||
*state.games_folder.write().await = accepted_path.clone();
|
||||
if accepted_path_changed {
|
||||
let mut game_db = state.games.write().await;
|
||||
clear_all_local_game_states(&mut game_db);
|
||||
}
|
||||
// Core's accepted root transition publishes the replacement local snapshot;
|
||||
// the transfer-status fence above has already applied its queued events.
|
||||
// Keep those local flags when committing the path. ListGames refreshes only
|
||||
// remote availability and cannot restore a snapshot erased here.
|
||||
|
||||
emit_games_list(&app_handle).await;
|
||||
if let Some(peer_ctrl) = state.peer_ctrl.read().await.as_ref()
|
||||
|
||||
Reference in New Issue
Block a user