Skip to content

Commit

Permalink
fix(RadioGroup): props reactivity issues (#1065)
Browse files Browse the repository at this point in the history
  • Loading branch information
romhml authored Dec 6, 2023
1 parent 1cb8df8 commit 7196d81
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/runtime/components/forms/RadioGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default defineComponent({
const { ui, attrs } = useUI('radioGroup', toRef(props, 'ui'), config, toRef(props, 'class'))
const { ui: uiRadio } = useUI('radio', toRef(props, 'uiRadio'), configRadio)
const { emitFormChange, color, name } = useFormGroup({ ...props, isFieldset: true }, config)
const { emitFormChange, color, name } = useFormGroup(props, config)
provide('radio-group', { color, name })
const onUpdate = (value: any) => {
Expand Down
5 changes: 3 additions & 2 deletions src/runtime/composables/useFormGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ type InputProps = {
size?: string | number | symbol
color?: string
name?: string
isFieldset?: boolean
eagerValidation?: boolean
legend?: string | null
}

export const useFormGroup = (inputProps?: InputProps, config?: any) => {
Expand All @@ -20,7 +20,8 @@ export const useFormGroup = (inputProps?: InputProps, config?: any) => {
const inputId = ref(inputProps?.id)

onMounted(() => {
inputId.value = inputProps?.isFieldset ? undefined : inputProps?.id ?? uid()
// Remove FormGroup label bindings for RadioGroup elements to avoid label conflicts
inputId.value = inputProps?.legend === null || inputProps.legend ? undefined : inputProps?.id ?? uid()

if (formGroup) {
// Updates for="..." attribute on label if inputProps.id is provided
Expand Down

1 comment on commit 7196d81

@vercel
Copy link

@vercel vercel bot commented on 7196d81 Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ui – ./

ui-nuxt-js.vercel.app
ui.nuxt.com
ui-git-dev-nuxt-js.vercel.app

Please sign in to comment.