From 0529aaf9bc314432118f32d83d9aac3b4e24a7b7 Mon Sep 17 00:00:00 2001 From: Mateusz Dionizy <62315827+deronek@users.noreply.github.com> Date: Sat, 6 Jul 2024 22:10:16 +0200 Subject: [PATCH] fix: select first value after search (#83) --- .changeset/brave-meals-build.md | 5 +++++ src/lib/cmdk/command.ts | 1 + 2 files changed, 6 insertions(+) create mode 100644 .changeset/brave-meals-build.md diff --git a/.changeset/brave-meals-build.md b/.changeset/brave-meals-build.md new file mode 100644 index 0000000..9211ff5 --- /dev/null +++ b/.changeset/brave-meals-build.md @@ -0,0 +1,5 @@ +--- +'cmdk-sv': patch +--- + +fix: select first value after search diff --git a/src/lib/cmdk/command.ts b/src/lib/cmdk/command.ts index 45508eb..90d0c59 100644 --- a/src/lib/cmdk/command.ts +++ b/src/lib/cmdk/command.ts @@ -244,6 +244,7 @@ export function createCommand(props: CommandProps) { tick().then(() => state.update((curr) => { curr.value = selectFirstItem() ?? ''; + props.onValueChange?.(curr.value); return curr; }) );