Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

fix: input value set

flooorianflo8e98a369c278
diff --git a/packages/ui/src/input-select.tsx b/packages/ui/src/input-select.tsx
index 7e346ce875..bc568a4ba7 100644
--- a/packages/ui/src/input-select.tsx
+++ b/packages/ui/src/input-select.tsx
@@ -56,6 +56,13 @@ export function InputSelect({
}
}, [commandRef, openCommandList]);
+ // hacks the input value to be empty when the selectedItem is empty
+ useEffect(() => {
+ if (!selectedItem?.value) {
+ setInputValue("");
+ }
+ }, [selectedItem?.value]);
+
const CommandInput = () => {
const isEmpty = useCommandState((state: any) => state.filtered.count === 0);
return (
@@ -66,7 +73,7 @@ export function InputSelect({
autoFocus={openCommandList}
// when focus on the input. only show the dropdown if there are tags and the tagValue is not empty
onFocus={() => setOpenCommandList(true)}
- value={selectedItem?.value === "" ? "" : inputValue}
+ value={inputValue}
onValueChange={setInputValue}
onKeyDown={(e) => {
if (e.key === "Escape") {