Skip to content

Commit

Permalink
fix: (combobox) allowsEmptyCollection should display dropdown even …
Browse files Browse the repository at this point in the history
…when `options` is empty
  • Loading branch information
MengLinMaker committed Oct 30, 2024
1 parent e3646e8 commit 013b2b7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/core/src/combobox/combobox-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,14 @@ export function ComboboxInput<T extends ValidComponent = "input">(
//
// To prevent this, we need to force the input `value` to be in sync with the input value state.
target.value = context.inputValue() ?? "";
context.open(false, "input");

if (context.isOpen()) {
if (collection().getSize() <= 0 && !context.allowsEmptyCollection()) {
context.close();
}
} else {
if (collection().getSize() > 0) {
context.open(false, "input");
}
} else if (collection().getSize() > 0 || context.allowsEmptyCollection()) {
context.open(false, "input");
}
};

Expand Down

0 comments on commit 013b2b7

Please sign in to comment.