refactor(#248): extract typeahead logic into createTypeahead composable, use in PersonTypeahead

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-16 23:07:59 +02:00
parent 83629e0c6e
commit 53d89a44fc
2 changed files with 38 additions and 48 deletions

View File

@@ -41,6 +41,12 @@ export function createTypeahead<T>(options: Options<T>) {
close();
}
/** Directly populate results without going through the debounce (e.g. on-focus preload). */
function openWith(items: T[]) {
results = items;
isOpen = true;
}
return {
get query() {
return query;
@@ -59,6 +65,7 @@ export function createTypeahead<T>(options: Options<T>) {
},
setQuery,
close,
select
select,
openWith
};
}