Skip to content

v3.17.0

Choose a tag to compare

@58bits 58bits released this 09 Jul 01:46

Highlights

  • @byline/core / @byline/admin — Added conditional field visibility: every schema field now accepts condition?: (data, siblingData) => boolean. When present, the admin form renders the field only while the predicate returns true, re-evaluated on every form edit. siblingData is the field's immediate scope (the enclosing group or array item), so a condition inside an array item observes its own item — one field definition drives per-item behaviour across an entire array, e.g. condition: (_data, siblingData) => Boolean(siblingData.generateThumbnail). Like readOnly, condition is a rendering hint only: the hidden field's stored value is retained (no clearing write is emitted), condition-hidden fields are exempt from client-side validation, and server-side schema validation is unaffected — pair conditionally-hidden required fields with optional: true or a defaultValue.

  • @byline/core / @byline/admin — Field hooks can now write across fields: FieldHookContext (received by beforeValidate / beforeChange) carries setFieldValue(path, value). It is a raw store write — the target field's own hooks do not run, which forecloses hook recursion — but it is otherwise a normal form edit: it emits a field.set patch (so it persists on save), marks the form dirty, and store-subscribed widgets re-render immediately. Combined with condition, this composes radio-group behaviour across array items: checking one item's checkbox unchecks its siblings and swaps which item's dependent field is visible. The new "Conditional visibility" and "Field hooks and cross-field writes" sections in docs/04-collections/01-fields.md document both features, including a server-side beforeCreate / beforeUpdate backstop recipe for enforcing such invariants beyond the editor.

Chores

  • @byline/admin — Commented out the dev-time FormContext.appendPatch console tracing that logged every accumulated patch to the dev console during editing.

All other @byline/* packages bumped to 3.17.0 in lockstep with no behavioural changes this cycle.