From 50c968a19c2472737f737fb35a260b83c0cc4bf3 Mon Sep 17 00:00:00 2001 From: Tanner Heffner Date: Thu, 21 Mar 2024 22:10:06 -0700 Subject: [PATCH] clean up list length logic --- src/routes/(main)/blog/+page.svelte | 28 +++++++++++++++++---------- src/routes/(main)/blog/fuzzySearch.js | 2 +- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/routes/(main)/blog/+page.svelte b/src/routes/(main)/blog/+page.svelte index b41ab95..e45d970 100644 --- a/src/routes/(main)/blog/+page.svelte +++ b/src/routes/(main)/blog/+page.svelte @@ -15,7 +15,7 @@ encode: (arr) => arr?.toString(), decode: (str) => str?.split(',')?.filter((e) => e) ?? [] }, - { debounceHistory: 500 } + { debounceHistory: 100 } ); let search = queryParam('filter', ssp.string(), { debounceHistory: 500 @@ -37,7 +37,7 @@ let list $: fuzzySearch(items, $selectedCategories, $search).then(_items => { - list = _items.slice(0, isTruncated ? LIST_DISPLAY_LENGTH : items.length) + list = _items }) @@ -68,7 +68,7 @@ aria-label="Search articles" type="text" bind:value={$search} - bind:this={inputEl} + bind:this={inputEl} placeholder="Hit / to search" class="block w-full rounded-md border border-zinc-400 bg-gray-200 px-4 py-2 text-gray-900 placeholder:text-zinc-700 @@ -121,15 +121,23 @@ - {#if isTruncated} + {#if isTruncated && list.length > LIST_DISPLAY_LENGTH}