Skip to content

Commit

Permalink
fix: fixed loading if game selected on key changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tormak9970 committed May 3, 2023
1 parent b0d4bb0 commit bb57f88
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/core/grids/Grids.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,13 @@
});
apiKeyUnsub = steamGridDBKey.subscribe(async (key) => {
isLoading = true;
if (key != "") {
if (key != "" && AppController.sgdbClientInitialized()) {
await filterGridsOnStateChange(key, $isOnline, $selectedGameAppId, $gridType, $selectedResultPage, $dbFilters);
} else {
availableSteamGridGames = [{ label: "None", data: "None"}];
$selectedGameAppId = null;
$selectedGameName = null;
$selectedSteamGridGameId = "None";
grids = [];
}
isLoading = false;
Expand Down
8 changes: 8 additions & 0 deletions src/lib/controllers/AppController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -774,4 +774,12 @@ export class AppController {
LogController.log(`New user id ${userId} matched old id ${oldUserId}.`);
}
}

/**
* Checks if the sgdb api client is initialized.
* @returns True if the sgdb api client is initialized.
*/
static sgdbClientInitialized(): boolean {
return !!AppController.cacheController?.client;
}
}

0 comments on commit bb57f88

Please sign in to comment.