Skip to content

v4.3.0

Choose a tag to compare

@58bits 58bits released this 17 Jul 12:57

Highlights

  • @byline/core / @byline/admin — per-field admin overrides (components slots, richtext editor) can now reach fields nested inside group / array structure using dotted, index-free schema-path keys — in both CollectionAdminConfig.fields (e.g. files.filesGroup.publicationFile) and defineBlockAdmin's fields map (e.g. faq.answer). Schema paths address field declarations, so one entry applies to that field in every array item; keys are validated at boot (validateBlockAdminConfigs / validateAdminConfigs) with clear errors for index-carrying keys, unresolvable paths, and paths that try to traverse a blocks field (inner blocks resolve their own blockAdmin registry entry). The notation is documented in the new "Schema paths vs instance paths" section of the fields doc; the reference implementation is the new FAQBlock (faq-block{.ts,.admin.ts}) in the example webapp.

  • @byline/adminarray fields nested inside blocks (and groups) are now fully structurally editable: the array title, add-row, and per-item add-below / remove / collapse controls render at every nesting depth — previously a freshly added block containing an array rendered completely blank, with no way to add an item. Arrays anywhere inside a block are also drag-sortable (each DraggableSortable is an independent dnd-kit context with grip-scoped listeners); arrays in plain top-level groups keep a conservative drag-free default while gaining add/remove. Items now carry positioned header labels ("Questions 1", "Questions 2"), and the item context-menu trigger gained an accessible name ("Item actions", translated across all seven admin locales in @byline/i18n).

  • @byline/core — the Zod schema builder now validates array items against their child field schemas instead of z.any(): requiredness and per-type checks apply inside items on the strict (write) schemas, array-level minLength / maxLength bounds are enforced, and read schemas stay lenient so schema-evolved documents keep parsing. The synthetic _id item identity is always accepted; group children keep their existing permissive depth boundary.

Bug Fixes

  • @byline/admin — fixed a latent patch-aliasing data-corruption bug in the form context: queued structural patches (array.insert, block add) held their item objects by live reference into the form store tree, so adding array items inside a block added in the same session silently rewrote the queued block patch — on save, the items were applied twice, persisting duplicated array items with identical _ids. Patches are now snapshotted (structuredClone) at append time. The bug was previously unreachable because the frozen-array defect (fixed above) made in-session structural edits inside new blocks impossible.

Chores

  • monorepo — two new Playwright suites cover the cycle end to end: array-in-block.spec.ts (add block → add items → fill → save → keyboard drag-reorder → remove, round-tripped through reloads) and block-admin-override.spec.ts (nested faq.answer editor override vs the site-wide AI editor), backed by an idempotent FAQ fixture seed. Fixed unsafe-optional-chaining lint errors in @byline/client / @byline/db-postgres tests — the root pnpm lint is green again.

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