mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-10-23 08:55:25 +00:00
fix: prevent Radix Select from clearing form values on reset (#5223)
This commit is contained in:
@@ -4,9 +4,21 @@ import type * as React from "react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
function Select({
|
||||
onValueChange,
|
||||
...props
|
||||
}: React.ComponentProps<typeof SelectPrimitive.Root>) {
|
||||
return <SelectPrimitive.Root data-slot="select" {...props} />;
|
||||
return (
|
||||
<SelectPrimitive.Root
|
||||
data-slot="select"
|
||||
// Radix's hidden native <select> emits "" when the value is set before
|
||||
// the options mount (e.g. form.reset), wiping the field. Items can't have
|
||||
// an empty value, so "" is never a real selection.
|
||||
onValueChange={(value) => {
|
||||
if (value !== "") onValueChange?.(value);
|
||||
}}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function SelectGroup({
|
||||
|
||||
Reference in New Issue
Block a user