Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

fix height combobox (virtual list)

Carl-Gerhard Lindesvärd3d0474d07b82
diff --git a/apps/dashboard/src/components/ui/combobox-advanced.tsx b/apps/dashboard/src/components/ui/combobox-advanced.tsx
index 0c7914211..8c8564244 100644
--- a/apps/dashboard/src/components/ui/combobox-advanced.tsx
+++ b/apps/dashboard/src/components/ui/combobox-advanced.tsx
@@ -121,7 +121,12 @@ export function ComboboxAdvanced({
value={inputValue}
onValueChange={setInputValue}
/>
- <VirtualList height={300} data={data} itemHeight={32} itemKey="value">
+ <VirtualList
+ height={Math.min(items.length * 32, 300)}
+ data={data}
+ itemHeight={32}
+ itemKey="value"
+ >
{renderItem}
</VirtualList>
</Command>
diff --git a/apps/dashboard/src/components/ui/combobox.tsx b/apps/dashboard/src/components/ui/combobox.tsx
index 8a6a8e48a..5edeca77e 100644
--- a/apps/dashboard/src/components/ui/combobox.tsx
+++ b/apps/dashboard/src/components/ui/combobox.tsx
@@ -124,7 +124,7 @@ export function Combobox<T extends string>({
<CommandEmpty>Nothing selected</CommandEmpty>
)}
<VirtualList
- height={300}
+ height={Math.min(items.length * 32, 300)}
data={items.filter((item) => {
if (search === '') return true;
return item.label.toLowerCase().includes(search.toLowerCase());