diff --git a/src/components/core/grids/Grids.svelte b/src/components/core/grids/Grids.svelte index 357048f3..34ef53a2 100644 --- a/src/components/core/grids/Grids.svelte +++ b/src/components/core/grids/Grids.svelte @@ -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; diff --git a/src/lib/controllers/AppController.ts b/src/lib/controllers/AppController.ts index 83cef7a5..454bf166 100644 --- a/src/lib/controllers/AppController.ts +++ b/src/lib/controllers/AppController.ts @@ -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; + } } \ No newline at end of file