Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(RadioGroup): props reactivity issues #1065

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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