Fix for offline mode
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import { page } from "$app/stores";
|
||||
import { truncateMiddle } from "$lib/utils/truncateMiddle";
|
||||
import { goto } from "$app/navigation";
|
||||
import { navigateBack } from "$lib/utils/navigation";
|
||||
@@ -53,6 +54,16 @@
|
||||
|
||||
onMount(async () => {
|
||||
await loadGenres();
|
||||
// Auto-select a genre when linked with ?genre=<name> (e.g. from a genre tag)
|
||||
const requestedGenre = $page.url.searchParams.get("genre");
|
||||
if (requestedGenre) {
|
||||
const match = genres.find(
|
||||
(g) => g.name.toLowerCase() === requestedGenre.toLowerCase(),
|
||||
);
|
||||
if (match) {
|
||||
await loadGenreItems(match);
|
||||
}
|
||||
}
|
||||
markLoaded();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user