Skip to content

Commit 4ca09a4

Browse files
committed
fix: createForm missing onboard override and SelfClosingElement type
- Add onboard() to createForm that batch-wraps register(), preventing bulk field registration from bypassing form-specific setup (validation state, Object.defineProperty value wrapping, pristine tracking) - Fix SelfClosingElement type: keyof typeof array gives numeric indices, (typeof array)[number] gives the correct string union of tag names
1 parent 3e83b89 commit 4ca09a4

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

packages/0/src/composables/createForm/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,14 @@ export function createForm<
260260
return ticket
261261
}
262262

263+
function onboard (registrations: Partial<Z>[]): E[] {
264+
return registry.batch(() => registrations.map(r => register(r)))
265+
}
266+
263267
return {
264268
...registry,
265269
register,
270+
onboard,
266271
reset,
267272
submit,
268273
validateOn,

packages/0/src/constants/htmlElements.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,4 @@ export type HTMLElementName = keyof HTMLElementTagNameMap
9898
/**
9999
* Type for self-closing HTML elements
100100
*/
101-
export type SelfClosingElement = keyof typeof selfClosingTags
101+
export type SelfClosingElement = (typeof selfClosingTags)[number]

0 commit comments

Comments
 (0)