From 1edf0c22d159fbbac86bceb0449cfbe54749dd16 Mon Sep 17 00:00:00 2001 From: 727021 <1834544+727021@users.noreply.github.com> Date: Mon, 16 Feb 2026 18:12:29 -0700 Subject: [PATCH] fix ButtonBar not setting value --- app/components/ButtonBar/index.tsx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/app/components/ButtonBar/index.tsx b/app/components/ButtonBar/index.tsx index e7090bd..9e0a28a 100644 --- a/app/components/ButtonBar/index.tsx +++ b/app/components/ButtonBar/index.tsx @@ -12,7 +12,6 @@ type Props = { label: ReactNode }[] onChange?: (value: string | number) => any - defaultValue?: string | number formApi: FormApi } @@ -22,15 +21,14 @@ const ButtonBar = ({ name, options, onChange, - defaultValue, formApi }: Props) => { - const [value, setValue] = useState(defaultValue) - - const error = formApi.error(name) + const field = formApi.field(name) + const value = field.value() + const error = field.error() const handleClick = (value: string | number) => { - setValue(value) + field.setValue(value) onChange?.(value) } @@ -45,8 +43,7 @@ const ButtonBar = ({