Skip to content

Commit

Permalink
Merge pull request #429 from Jared-MB/main
Browse files Browse the repository at this point in the history
⚙️ Listen to search params to clear results
  • Loading branch information
pheralb authored Oct 29, 2024
2 parents cf2efef + 82a6dfb commit 1ae2e81
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/components/search.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="ts">
import { page } from '$app/stores';
import { inputStyles } from '@/ui/styles';
import { Command, SearchIcon } from 'lucide-svelte';
export let searchTerm: string;
Expand All @@ -24,6 +25,17 @@
}
};
}
let searchParams = {} as { [key: string]: string };
$: {
if ($page) {
searchParams = Object.fromEntries($page.url.searchParams);
if (!searchParams?.search) {
clearSearch();
}
}
}
</script>

<div class="sticky top-[63px] z-50">
Expand Down

0 comments on commit 1ae2e81

Please sign in to comment.