diff --git a/web/src/lib/components/trail/trail_list.svelte b/web/src/lib/components/trail/trail_list.svelte index c05e440d..0f484d4a 100644 --- a/web/src/lib/components/trail/trail_list.svelte +++ b/web/src/lib/components/trail/trail_list.svelte @@ -49,15 +49,16 @@ if (storedDisplayOption) { selectedDisplayOption = storedDisplayOption; } - if (filter && storedSort) { - filter.sort = storedSort as typeof filter.sort; + if (filter) { + filter.sort = + (storedSort as typeof filter.sort | null) ?? filter.sort; } - if (filter && storedSortOrder) { - filter.sortOrder = storedSortOrder as typeof filter.sortOrder; - } - if (storedSort || storedSortOrder) { - dispatch("update", filter); + if (filter) { + filter.sortOrder = + (storedSortOrder as typeof filter.sortOrder | null) ?? + filter.sortOrder; } + dispatch("update", filter); }); function setDisplayOption() { @@ -148,9 +149,9 @@ {:else} {#each { length: 12 } as _, index} {#if selectedDisplayOption === "cards"} -
- -
+
+ +
{:else if selectedDisplayOption === "list"} {/if} @@ -180,7 +181,8 @@ data-sveltekit-preload-data="off" > {#if selectedDisplayOption === "cards"} - + {:else} {/if} diff --git a/web/src/routes/trails/+page.svelte b/web/src/routes/trails/+page.svelte index 1f15f96f..7bc62dd3 100644 --- a/web/src/routes/trails/+page.svelte +++ b/web/src/routes/trails/+page.svelte @@ -28,7 +28,7 @@ async function handleFilterUpdate() { loading = true; const response = await trails_search_filter(filter, pagination.page); - trails = response.items; + trails = response.items; pagination.page = response.page; pagination.totalPages = response.totalPages; loading = false;