Closes the last user-facing gap on the games list: remove a saved game, and redirect to the home screen when a game is missing or has been deleted.
What changed
DELETE /api/games/:id — new route; returns 404 {error:'game not found'} when absent, otherwise {deleted:true} and pushes an SSE error event to any open tab of that game.
Db.delete(id) — prepared DELETE FROM games WHERE id=?, reports whether a row was removed.
Home screen — each saved-game card gains a small trash button that opens a confirm dialog (Cancel / Delete); deleting removes it from the list.
Missing/deleted games no longer get stuck — useSse now surfaces the server's error event, and the app returns to home on deleted/not found. So a live tab whose game is deleted (by you or another tab) goes home, and a deep link to a deleted/never-existing game lands on the home screen instead of a broken game view.
DeleteGameResponse added to shared/protocol.ts; api.deleteGame() added to the client helper.
Tests — new Db.delete unit test (45 total) + 2 e2e tests: (1) delete from the home screen with confirmation (cancel keeps it, confirm removes it and a follow-up GET 404s); (2) deleting an open game returns the active tab home via the SSE error, and a fresh deep link to the deleted id lands on home.
Verification
typecheck ✓ · lint ✓ · unit 45/45 ✓ · build ✓ (client bundle index-CXkLWnfV.js). e2e runs in CI.
Full notes in CHANGELOG.md (v0.8.0).
Fixes #20
## v0.8.0
Closes the last user-facing gap on the games list: **remove a saved game**, and **redirect to the home screen** when a game is missing or has been deleted.
### What changed
- **`DELETE /api/games/:id`** — new route; returns `404 {error:'game not found'}` when absent, otherwise `{deleted:true}` and pushes an SSE `error` event to any open tab of that game.
- **`Db.delete(id)`** — prepared `DELETE FROM games WHERE id=?`, reports whether a row was removed.
- **Home screen** — each saved-game card gains a small trash button that opens a **confirm dialog** (Cancel / Delete); deleting removes it from the list.
- **Missing/deleted games no longer get stuck** — `useSse` now surfaces the server's `error` event, and the app returns to home on `deleted`/`not found`. So a live tab whose game is deleted (by you or another tab) goes home, and a deep link to a deleted/never-existing game lands on the home screen instead of a broken game view.
- **`DeleteGameResponse`** added to `shared/protocol.ts`; **`api.deleteGame()`** added to the client helper.
- **Tests** — new `Db.delete` unit test (45 total) + 2 e2e tests: (1) delete from the home screen with confirmation (cancel keeps it, confirm removes it and a follow-up `GET` 404s); (2) deleting an open game returns the active tab home via the SSE error, and a fresh deep link to the deleted id lands on home.
### Verification
`typecheck` ✓ · `lint` ✓ · `unit 45/45` ✓ · `build` ✓ (client bundle `index-CXkLWnfV.js`). e2e runs in CI.
Full notes in `CHANGELOG.md` (v0.8.0).
- DELETE /api/games/:id route + Db.delete() (404 when absent)
- PresetPicker: per-saved-game trash button + confirm dialog (Cancel/Delete)
- App: runDeleteGame; useSse onError -> goHome on 'deleted'/'not found'
(a deleted/missing game now returns the live tab and any deep link home)
- DeleteGameResponse in shared/protocol.ts; api.deleteGame()
- unit test (Db.delete) + 2 e2e tests (home-screen delete; in-flight delete
returns the active tab home and a fresh deep link lands on home)
- version 0.7.0 -> 0.8.0 + changelog
Fixes#20
kamilkrzywda
scheduled this pull request to auto merge when all checks succeed 2026-10-11 22:35:57 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Fixes #20
v0.8.0
Closes the last user-facing gap on the games list: remove a saved game, and redirect to the home screen when a game is missing or has been deleted.
What changed
DELETE /api/games/:id— new route; returns404 {error:'game not found'}when absent, otherwise{deleted:true}and pushes an SSEerrorevent to any open tab of that game.Db.delete(id)— preparedDELETE FROM games WHERE id=?, reports whether a row was removed.useSsenow surfaces the server'serrorevent, and the app returns to home ondeleted/not found. So a live tab whose game is deleted (by you or another tab) goes home, and a deep link to a deleted/never-existing game lands on the home screen instead of a broken game view.DeleteGameResponseadded toshared/protocol.ts;api.deleteGame()added to the client helper.Db.deleteunit test (45 total) + 2 e2e tests: (1) delete from the home screen with confirmation (cancel keeps it, confirm removes it and a follow-upGET404s); (2) deleting an open game returns the active tab home via the SSE error, and a fresh deep link to the deleted id lands on home.Verification
typecheck✓ ·lint✓ ·unit 45/45✓ ·build✓ (client bundleindex-CXkLWnfV.js). e2e runs in CI.Full notes in
CHANGELOG.md(v0.8.0).