From 1b3bec0dade7bcb0e5890caa0900d38d701c71f6 Mon Sep 17 00:00:00 2001 From: Not-Jayden Date: Sun, 19 Nov 2023 03:05:39 +0800 Subject: [PATCH 1/4] fix: maintain original order when clearing search value --- src/lib/cmdk/components/CommandList.svelte | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/lib/cmdk/components/CommandList.svelte b/src/lib/cmdk/components/CommandList.svelte index 6211997..e0da3b4 100644 --- a/src/lib/cmdk/components/CommandList.svelte +++ b/src/lib/cmdk/components/CommandList.svelte @@ -1,9 +1,10 @@ -{#if asChild} - -{:else} -
-
- +{#key $state.search === ''} + {#if asChild} + + {:else} +
+
+ +
-
-{/if} + {/if} +{/key} \ No newline at end of file From a0b6653ec465dfd43c6ed1ec5e7194879c105211 Mon Sep 17 00:00:00 2001 From: Not-Jayden Date: Sun, 19 Nov 2023 03:05:58 +0800 Subject: [PATCH 2/4] chore: add changeset --- .changeset/brave-lions-argue.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/brave-lions-argue.md diff --git a/.changeset/brave-lions-argue.md b/.changeset/brave-lions-argue.md new file mode 100644 index 0000000..0b0fc55 --- /dev/null +++ b/.changeset/brave-lions-argue.md @@ -0,0 +1,5 @@ +--- +'cmdk-sv': patch +--- + +fix: maintain original list order when clearing search value From e6779837d4a2b4e004c14806ac87282cef541cfc Mon Sep 17 00:00:00 2001 From: Not-Jayden Date: Sun, 19 Nov 2023 03:10:26 +0800 Subject: [PATCH 3/4] chore: add empty line --- src/lib/cmdk/components/CommandList.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/cmdk/components/CommandList.svelte b/src/lib/cmdk/components/CommandList.svelte index e0da3b4..8e98f3e 100644 --- a/src/lib/cmdk/components/CommandList.svelte +++ b/src/lib/cmdk/components/CommandList.svelte @@ -66,4 +66,4 @@
{/if} -{/key} \ No newline at end of file +{/key} From 685467cf6f9df83cb5abc15ce698175e19da9c3d Mon Sep 17 00:00:00 2001 From: Not-Jayden Date: Sun, 19 Nov 2023 03:24:32 +0800 Subject: [PATCH 4/4] fix: move key up --- src/lib/cmdk/components/CommandList.svelte | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/lib/cmdk/components/CommandList.svelte b/src/lib/cmdk/components/CommandList.svelte index 8e98f3e..d8982b4 100644 --- a/src/lib/cmdk/components/CommandList.svelte +++ b/src/lib/cmdk/components/CommandList.svelte @@ -56,14 +56,16 @@ }; -{#key $state.search === ''} - {#if asChild} +{#if asChild} + {#key $state.search === ''} - {:else} -
-
+ {/key} +{:else} +
+
+ {#key $state.search === ''} -
+ {/key}
- {/if} -{/key} +
+{/if}