GitHub

@@ -50,7 +50,7 @@ export type FormProps<S extends FormSchema, T extends boolean = true, N extends

5050

* If true, this form will attach to its parent Form and validate at the same time.

5151

* @defaultValue `false`

5252

*/

53-

nested?: N

53+

nested?: N & boolean

54545555

/**

5656

* When `true`, all form elements will be disabled on `@submit` event.

@@ -104,15 +104,12 @@ const formId = props.id ?? useId() as string

104104105105

const bus = useEventBus<FormEvent<I>>(`form-${formId}`)

106106107-

// The comparison with '' is needed because vue is not casting boolean correctly without

108-

// explicitly setting the prop to true (`:nested="true" works, but `nested` returns '')

109-

const isNested = props.nested?.toString() === '' || props.nested === true

110-

const parentBus = isNested && inject(

107+

const parentBus = props.nested === true && inject(

111108

formBusInjectionKey,

112109

undefined

113110

)

114111115-

const parentState = isNested ? inject(formStateInjectionKey, undefined) : undefined

112+

const parentState = props.nested === true ? inject(formStateInjectionKey, undefined) : undefined

116113

const state = computed(() => {

117114

if (parentState?.value) {

118115

return props.name ? getAtPath(parentState.value, props.name) : parentState.value

Read the original on github.com ↗