Merge pull request #429 from Jared-MB/main
Some checks are pending
🧑‍🚀 Check / ⚡ Testing with Vitest (push) Waiting to run
🧑‍🚀 Check / 📦 SVGs Size (push) Waiting to run
🧑‍🚀 Check / 🛠️ Build app (push) Waiting to run
🚀 Deploy / API - Cloudflare Workers (push) Waiting to run

⚙️ Listen to search params to clear results
This commit is contained in:
Pablo Hdez 2024-10-29 08:55:25 +00:00 committed by GitHub
commit 1ae2e81836
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { page } from '$app/stores';
import { inputStyles } from '@/ui/styles'; import { inputStyles } from '@/ui/styles';
import { Command, SearchIcon } from 'lucide-svelte'; import { Command, SearchIcon } from 'lucide-svelte';
export let searchTerm: string; export let searchTerm: string;
@ -24,6 +25,17 @@
} }
}; };
} }
let searchParams = {} as { [key: string]: string };
$: {
if ($page) {
searchParams = Object.fromEntries($page.url.searchParams);
if (!searchParams?.search) {
clearSearch();
}
}
}
</script> </script>
<div class="sticky top-[63px] z-50"> <div class="sticky top-[63px] z-50">