Reconciliation on mount
Because config is the source of truth,
a page’s saved values and its section config can fall out of step: you add a
field to hero.yaml, and pages saved before that edit have no value for it.
Reconciliation is how SEK resolves that gap. Every time the editor mounts, it
walks the current config and the stored _sek_data together and produces a
consistent working state, without you running a migration.
What happens on mount
Section titled “What happens on mount”When the editor loads a page, for each section instance it compares the saved values against the section type’s current config and:
- Missing fields get defaults. A field that exists in the config but has no saved value (because it was added after the page was last saved, or never filled in) is initialised to its default. The editor opens with the field present and ready, not absent.
- Removed fields are preserved, not dropped. A saved value whose field no
longer exists in the config (because the field was removed or its handle
changed) is not deleted. It moves to a
lostValuesstore on that section instance. See lost values. - Re-added fields recover their value. If a field that had moved to
lostValuesreappears in the config (you add the handle back), its old value is restored fromlostValuesautomatically. Removing and re-adding a field is non-destructive. - Template paths update. If a section’s
templatePathchanged in config, the reconciled instance picks up the new template.
The result is that stored content always meets the current definition of a section, computed fresh at load time rather than baked in at save time.
It matches by handle, and it recurses
Section titled “It matches by handle, and it recurses”Two properties make reconciliation reliable:
It matches by handle, not by label or position. Reorder a section’s fields, or rename a field’s label, and every saved value still finds its field. Only changing a handle breaks the match. That break is caught as a lost value rather than a silent mis-attachment.
It recurses through the whole config tree. Section instances are not a flat
list: they live inside sections, children, and tabs wrappers to arbitrary
depth. Reconciliation descends the config tree driven by the field type at each
level, so a value buried three levels deep in a tabbed layout is reconciled the
same way a top-level one is. There is no enumerable “list of places a section
can be”; reconciliation follows the config wherever it leads.
Why it runs in the editor
Section titled “Why it runs in the editor”Reconciliation is a data-layer operation: it computes the corrected state
that the editor then works with, and any user-visible consequences (a field
reappearing, a value surfacing in the Inactive Fields panel) are drained to the
UI after the editor has mounted. You do not trigger it and there is no
reconcile button: it is simply the state the editor is always in. Saving writes
the reconciled values back to _sek_data, so the page’s stored content
converges on the current config as a natural side effect of being edited.
For the deeper mechanics (the dotted-path scheme, explicit migration rules, and how large-scale config changes are rolled out across many pages at once), see Schema Evolution.