Form / foldkit-form
Editing existing values
fill populates drafts from loaded values while keeping drafts for keys omitted
from the patch:
ts
const load = RenameForm.helpers.fill({ id: 'p1', title: 'Hello' }) // an Update.Step of the pageDerive both the load Selection and the fill shape from Rename.input:
ts
const Current = Entity.selectFor(Rename.input) // a Selection of `id` and `title`
declare const loaded: typeof Current.schema.Type
const prefill = RenameForm.helpers.fill(Entity.valuesFor(Rename.input, loaded))Relations load as refs and convert back into IDs for pickers (see
foldkit-entity).
foldkit-crud automates loading, filling, saving, and
save status tracking.
Did an edit change anything?
authoredChanged(before, after) reports whether a transition changed authored
drafts or rows:
ts
const message = Rename.Message.Changed({ key: 'title', value: 'Hello' })
const next = Rename.bundle.update(Rename.initial, message, undefined)
if (Rename.authoredChanged(Rename.initial, next.model)) scheduleAutosave()It compares authored state across both Models directly, so blurs, refused
inputs, search text, subject, and row bookkeeping return false, letting
packages like foldkit-cms trigger autosave reliably.