Skip to content

Commit

Permalink
fix(searchbar): clear input text when no matches are found and clear …
Browse files Browse the repository at this point in the history
…button is clicked
  • Loading branch information
valeriesauer committed Dec 16, 2024
1 parent 1c91448 commit da85c1b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
} from "../../stores/query";
import { iconStore } from "../../stores/icons";
import type { QueryItem } from "../../types/queryData";
import { createEventDispatcher } from "svelte";
const dispatch = createEventDispatcher();
export let itemToDelete: { type: string; index: number; item?: QueryItem };
$: deleteUrl = $iconStore.get("deleteUrl");
Expand All @@ -17,6 +20,8 @@
* can be a group, item or value
*/
const deleteItem = (): void => {
dispatch("clear-search");
if (type === "group") {
queryStore.update((query) => {
query = query.filter((group, i) => i !== index);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,5 +434,12 @@
{/if}
</ul>
{/if}
<StoreDeleteButtonComponent itemToDelete={{ type: "group", index }} />
<StoreDeleteButtonComponent
itemToDelete={{ type: "group", index }}
on:clear-search={() => {
inputValue = "";
focusedItemIndex = -1;
$inputOptions = [];
}}
/>
</div>

0 comments on commit da85c1b

Please sign in to comment.