Refactor select component to streamline value handling
- Removed the `onValueChange` prop from the select component to simplify its interface. - Updated the alias filter select component to ensure the selected value defaults to "all" if not present in available aliases, enhancing user experience.
This commit is contained in:
1 parent
3ce37b6067
commit
8b996c6e25
2 files changed
+2
-14
No files matched your search
@@ -15,7 +15,6 @@
|
||||
|
||||
$effect(() => {
|
||||
if (!value) value = "all";
|
||||
if (value !== "all" && !availableAliases.includes(value)) value = "all";
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -4,19 +4,8 @@
|
||||
let {
|
||||
open = $bindable(false),
|
||||
value = $bindable(),
|
||||
onValueChange,
|
||||
...restProps
|
||||
}: SelectPrimitive.RootProps & {
|
||||
onValueChange?: (next: string | string[]) => void;
|
||||
} = $props();
|
||||
}: SelectPrimitive.RootProps = $props();
|
||||
</script>
|
||||
|
||||
<SelectPrimitive.Root
|
||||
bind:open
|
||||
bind:value={value as never}
|
||||
onValueChange={(next: unknown) => {
|
||||
value = next as typeof value;
|
||||
onValueChange?.(next as string | string[]);
|
||||
}}
|
||||
{...restProps}
|
||||
/>
|
||||
<SelectPrimitive.Root bind:open bind:value={value as never} {...restProps} />
|
||||
Reference in new issue
Block a user