From bcaf28dceec0f369f2174decdf5f2a37e67f10d1 Mon Sep 17 00:00:00 2001 From: ddidderr Date: Tue, 19 May 2026 20:46:31 +0200 Subject: [PATCH] fix(ui): count all-games filter from network games The launcher redesign showed the All Games pill count from the full bundled catalog. That made the counter report every row in game.db even though the All Games filter itself only shows games that are visible on the current network or present locally. Use the same network-visible predicate for the counter and the filter. The pill count and results total now describe the displayed network library instead of the baked catalog size. Test Plan: - git diff --check Refs: user redesign nitpick about All Games counter --- crates/lanspread-tauri-deno-ts/src/lib/gameState.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/lanspread-tauri-deno-ts/src/lib/gameState.ts b/crates/lanspread-tauri-deno-ts/src/lib/gameState.ts index ab50802..6c8015b 100644 --- a/crates/lanspread-tauri-deno-ts/src/lib/gameState.ts +++ b/crates/lanspread-tauri-deno-ts/src/lib/gameState.ts @@ -157,8 +157,11 @@ export interface FilterCounts { installed: number; } +const isNetworkGame = (game: Game): boolean => + game.installed || game.downloaded || game.peer_count > 0; + export const countByFilter = (games: Game[]): FilterCounts => ({ - all: games.length, + all: games.filter(isNetworkGame).length, local: games.filter(g => g.installed || g.downloaded).length, installed: games.filter(g => g.installed).length, }); @@ -170,7 +173,7 @@ const matchesFilter = (game: Game, filter: GameFilter): boolean => { case 'installed': return game.installed; case 'all': - return game.installed || game.downloaded || game.peer_count > 0; + return isNetworkGame(game); } };