Skip to content

Commit

Permalink
fix: grids now reset properly on game change
Browse files Browse the repository at this point in the history
  • Loading branch information
Tormak9970 committed May 9, 2024
1 parent c9c3e9f commit 31672e5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/components/core/grids/GridResults.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,10 @@
$selectedSteamGridGameId = sgdbGameId;
});
} else {
handleLoadOnScroll();
isLoading = false;
handleLoadOnScroll().then(() => {
isLoading = false;
});
}
} else {
isLoading = false;
}
});
</script>
Expand All @@ -90,7 +89,7 @@
</div>
{:else}
<div class="message">
No results for {$gridType === GridTypes.HERO ? "Heroe" : $gridType}s for "{$selectedGameName}".
No results for {$gridType === GridTypes.HERO ? "Heroe" : $gridType}s for "{$steamGridSearchCache[$selectedGameAppId].find((game) => game.id.toString() === $selectedSteamGridGameId).name}".
</div>
{/if}
{/if}
Expand Down
7 changes: 7 additions & 0 deletions src/components/core/grids/Grids.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
let windowWidth: number;
let skipUpdate = false;
let selectedAppIdUnsub: Unsubscriber;
let steamGridSearchCacheUnsub: Unsubscriber;
let manualGamesUnsub: Unsubscriber;
let customGameNamesUnsub: Unsubscriber;
Expand Down Expand Up @@ -130,6 +131,11 @@
}
});
selectedAppIdUnsub = selectedGameAppId.subscribe(() => {
availableSteamGridGames = [ { label: "None", data: "None" } ];
$selectedSteamGridGameId = "None";
})
selectedPlatformUnsub = currentPlatform.subscribe((platform) => {
resetGridStores();
});
Expand All @@ -139,6 +145,7 @@
});
onDestroy(() => {
if (selectedAppIdUnsub) selectedAppIdUnsub();
if (steamGridSearchCacheUnsub) steamGridSearchCacheUnsub();
if (manualGamesUnsub) manualGamesUnsub();
if (customGameNamesUnsub) customGameNamesUnsub();
Expand Down

0 comments on commit 31672e5

Please sign in to comment.