fix(offline): delete a finished local game from the device, not the network
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Has been skipped
CI / integration (pull_request) Has been skipped
CI / ui (pull_request) Successful in 1m10s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m41s
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Has been skipped
CI / integration (pull_request) Has been skipped
CI / ui (pull_request) Successful in 1m10s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m41s
The lobby's finished-game delete (hide) always called gateway.hideGame; for a local (offline) game the transport kill switch refused it, so it toasted and the game stayed. Route by id: a local game is removed from the device store + the source cache (LocalSource.delete), an online game still hides on the backend.
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
|
||||
import { LocalGame, type LocalMove } from './engine';
|
||||
import { serializeGame, replayGame, type LocalGameRecord, type Seat as LocalSeat } from './serialize';
|
||||
import { getLocalGame, saveLocalGame, listLocalGames } from './store';
|
||||
import { getLocalGame, saveLocalGame, listLocalGames, deleteLocalGame } from './store';
|
||||
import { RULESETS } from './ruleset';
|
||||
import { getDawg } from '../dict';
|
||||
import { LOCAL_ID_PREFIX, isLocalGameId } from './id';
|
||||
@@ -151,6 +151,14 @@ export class LocalSource implements GameLoopSource {
|
||||
return views;
|
||||
}
|
||||
|
||||
/** delete removes a local game from the store and the in-memory cache — the offline lobby's
|
||||
* finished-game delete. Best-effort: a failed store delete still drops it from this session. */
|
||||
async delete(gameId: string): Promise<void> {
|
||||
this.live.delete(gameId);
|
||||
this.listeners.delete(gameId);
|
||||
await deleteLocalGame(gameId);
|
||||
}
|
||||
|
||||
async gameState(gameId: string): Promise<StateView> {
|
||||
return this.stateView(await this.load(gameId));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user