Skip to content

feat: prefill a form with the object being edited - #7

Merged
wolfoo2931 merged 1 commit into
mainfrom
add_default_values
Aug 22, 2026
Merged

feat: prefill a form with the object being edited#7
wolfoo2931 merged 1 commit into
mainfrom
add_default_values

Conversation

@wolfoo2931

Copy link
Copy Markdown
Owner

Adds a defaultValues form option, so editing a record is the same call as asking for one: ask(fields, { defaultValues: user }).

Keys naming no field are ignored, seeded values win over defaultValue (async ones included), and array fields take their records directly. Applied at build time as well, so isActive is right on first paint.

Documented on a new Editing guide page.

What this changes

Checklist

  • npm run typecheck && npm run lint && npm test && npm run build pass
  • Tests added or updated (a regression test, if this fixes a bug)
  • Documentation updated, if behaviour or the API changed

DOM contract

  • This does not change the rendered DOM, or test/domContract.test.ts
    was updated deliberately and the change is described below

Adds a `defaultValues` form option, so editing a record is the same
call as asking for one: `ask(fields, { defaultValues: user })`.

Keys naming no field are ignored, seeded values win over `defaultValue`
(async ones included), and `array` fields take their records directly.
Applied at build time as well, so `isActive` is right on first paint.

Documented on a new Editing guide page.
@wolfoo2931
wolfoo2931 merged commit 26acd4e into main Aug 22, 2026
7 checks passed
@wolfoo2931
wolfoo2931 deleted the add_default_values branch August 22, 2026 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant