Replies: 3 comments 11 replies
-
I have exactly same issue :) |
Beta Was this translation helpful? Give feedback.
-
Hey @SHAGGYER, adding |
Beta Was this translation helpful? Give feedback.
-
I dont understand why mines not working, im dynamically fetching the items and have shouldFilter as false but every time I type the input becomes unfocused and I cant type? Can anyone see what could be going on from the code below, maybe something with it being rendered in popover + inputs + radix + focus, one of these conflicting with each other? Screen.Recording.2025-09-24.at.19.43.58.movfunction DataRecordCommand({
label,
dataSourceId,
onSelectRecord,
}: {
label: string;
dataSourceId: string;
onSelectRecord: (id: string, label: string) => void;
}) {
const [search, setSearch] = useState("");
const trpc = useTRPC();
const { data: dataSource, isPending } = useQuery(
trpc.dataSource.byIdWithRecords.queryOptions(
{ dataSourceId, search },
{ placeholderData: keepPreviousData },
),
);
return (
<Command shouldFilter={false}>
<CommandInput
placeholder={`Search ${label}`}
value={search}
onValueChange={setSearch}
/>
<CommandList>
<CommandEmpty>
{isPending
? "Loading"
: search
? "No results found."
: "Type to search..."}
</CommandEmpty>
{dataSource?.records && dataSource?.records.length > 0 && (
<CommandGroup
heading={
dataSource?.records && dataSource?.records.length > 0
? search
? "Search Results"
: "Recent Records"
: ""
}
>
{dataSource?.records.map((record) => (
<CommandItem
key={record.id}
value={record.id}
className="p-0 w-full"
onSelect={() => onSelectRecord(record.id, record.label)}
>
<DropdownMenuItem className="w-full cursor-pointer">
{record.label}
</DropdownMenuItem>
</CommandItem>
))}
{!search && dataSource?.count && dataSource.records.length > 5 && (
<div className="px-2 py-1 text-xs text-muted-foreground text-center">
Type to search all {dataSource.count.total} records
</div>
)}
</CommandGroup>
)}
</CommandList>
</Command>
);
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have created an Autocomplete component using combobox. So the results and CommandItems will be always changing. However the CommandEmpty is showing up without a reason. When i console.log(results), the array is fine.
ALSO, when there are CommandItems on the screen, they are not clickable.
Beta Was this translation helpful? Give feedback.
All reactions