Refactor select component to streamline value handling
Publish telemt-api gateway Docker image / test (push) Successful in 28s
Publish telemt-api gateway Docker image / build-and-push (push) Successful in 2m20s

- 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:
Denozordec
2026-04-10 15:22:19 +07:00
parent 3ce37b6067
commit 8b996c6e25
2 changed files with 2 additions and 14 deletions
@@ -15,7 +15,6 @@
$effect(() => {
if (!value) value = "all";
if (value !== "all" && !availableAliases.includes(value)) value = "all";
});
</script>
+2 -13
View File
@@ -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} />