Skip to content

Commit

Permalink
fix: selected sgdb game saves on grid type change
Browse files Browse the repository at this point in the history
  • Loading branch information
Tormak9970 committed May 5, 2023
1 parent f4ffba9 commit 10a9bbb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/core/grids/Grids.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
*/
async function filterGridsOnStateChange(sgdbApiKey: string, online: boolean, selectedAppId: number, selectedGridType: GridTypes, resultsPage: number, filters: DBFilters): Promise<void> {
if (online && sgdbApiKey != "" && selectedAppId != null) {
const unfilteredGrids = await AppController.getSteamGridArt(selectedAppId, resultsPage);
const unfilteredGrids = await AppController.getSteamGridArt(selectedAppId, resultsPage, $selectedSteamGridGameId);
grids = filterGrids(unfilteredGrids, selectedGridType, filters);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/lib/controllers/CacheController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@ export class CacheController {
steamGridSteamAppIdMap[appId] = gameId;
}

let choosenResult = selectedSteamGridId ? results.find((game) => game.id.toString() == selectedSteamGridId) : results.find((game) => game.id.toString() == gameId);
let choosenResult = selectedSteamGridId ? results.find((game) => game.id.toString() == selectedSteamGridId) : null;
choosenResult ||= results.find((game) => game.id.toString() == gameId);
if (!choosenResult && results.length > 0) choosenResult = results[0];

if (choosenResult?.id) {
Expand Down

0 comments on commit 10a9bbb

Please sign in to comment.