Skip to content

fix(cms): expand recursive schema types when their nested items are opened - #7903

Merged
guitavano merged 1 commit into
mainfrom
guitavano/adidas-aba-novidades-editar
Oct 14, 2026
Merged

guitavano merged 1 commit into
mainfrom
guitavano/adidas-aba-novidades-editar

Conversation

@guitavano

@guitavano guitavano commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What is this contribution about?

#7899 stopped resolveSchema from re-expanding a $ref that is already on the current path. That fixed the hang on recursive commerce types (Product → hasVariant: Product[]), but the cut node lost its properties/items. Recursive data types broke as a result. A site's menu Item has children?: Item[], so the child items appear in the list, but each child opens as an empty form: only the multivariate variant/rule chrome shows and there are no fields to edit.

This change keeps the cut and makes it lazy:

  • resolve-schema.ts: the cut node now carries recursiveRef (the re-entered $ref), and the new resolveSchemaRef(ref, meta) builds that definition on its own.
  • fields/resolved-schema-cache.ts: expandRecursiveSchema fills in the skipped level (properties/required/items) and keeps the field's own title and description. It caches the result per node, so re-renders get the same object back.
  • renderField expands cut array and object fields. ArrayField expands a cut item schema (e.g. Product[] items). Each drill expands one level, and the next re-entry is cut again, so the hang guard still holds.

How did you verify your code works?

  • I ran resolveSchema against the real /live/_meta of an affected site. Before the fix, navItems → desktop[] → children resolved to { type: "array" } with no items. After it, expandRecursiveSchema gives the child item and the grandchild item all their fields (label, flagNew, banner, countBadge, children, url, display). The whole header section still resolves in about 10ms.
  • New tests in resolve-schema.test.ts: the cut node carries recursiveRef for Product; resolveSchemaRef builds the skipped level and cuts the next re-entry again; a recursive array def (Item.children: Item[]) is marked and expands with titleBy.
  • New tests in fields/resolved-schema-cache.test.ts: the expansion keeps the field title, returns the same object on every call, and is a no-op without recursiveRef or meta.
  • bun run verify passes: 10865 tests, 0 failures.
  • Not run: a manual check in the Site Editor UI.

Screenshots/Demonstration

No screenshots: I didn't run the Site Editor against an affected site.

How to Test

  1. Open the Site Editor on a site whose section has a recursive array prop, e.g. a header menu whose Item has children?: Item[].
  2. Open the nav items, open a top-level item, then click one of its "children" items.
  3. Expected: the child item's fields (text, URL, flag, banner, …) render and save. Before this fix the panel was empty below the variant rule.

Review Checklist

  • PR title is clear and descriptive
  • Changes are tested and working
  • Documentation is updated (if needed)
  • No breaking changes

🤖 Generated with Claude Code


Summary by cubic

Fixes recursive data-type forms that opened empty after #7899's recursion guard. When a recursive type re-entered itself (Product → hasVariant: Product[], menu Item with children?: Item[]), the cut node kept its type but lost its properties/items, so child items appeared in the list but each one rendered no fields.

The cut node now carries a recursiveRef, and the form fills in that skipped level on demand via the cached expandRecursiveSchema helper when renderField or ArrayField reaches it—restoring editable fields while keeping the recursion guard intact, one level at a time.

Bug Fixes

  • Recursive object and array properties now render their nested fields instead of an empty panel.
  • Re-expanding the same node returns a cached object, so re-renders get stable references.

Written for commit 128884d. Summary will update on new commits.

View guided diff Turn on auto-fix

…pened

#7899 stopped resolveSchema from re-expanding a `$ref` already on the
path, which fixed the hang on recursive commerce types but left the cut
node without `properties`/`items`. A recursive menu type
(`Item.children: Item[]`) therefore listed its child items but opened
each one as an empty form.

Mark the cut node with `recursiveRef` and expand it one level on demand
(`resolveSchemaRef` + cached `expandRecursiveSchema`) when renderField or
ArrayField reaches it, so the hang guard stays while nested levels remain
editable.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@github-actions github-actions Bot added the claude PR authored by a coding agent label Oct 14, 2026
@guitavano
guitavano merged commit 6d8748d into main Oct 14, 2026
34 checks passed
@guitavano
guitavano deleted the guitavano/adidas-aba-novidades-editar branch October 14, 2026 14:17
decocms Bot pushed a commit that referenced this pull request Oct 14, 2026
PR: #7903 fix(cms): expand recursive schema types when their nested items are opened
Bump type: patch

- decocms (apps/api/package.json): 4.478.0 -> 4.478.1
- @decocms/native (apps/native/package.json): 4.478.0 -> 4.478.1

Deploy-Scope: web
tlgimenes added a commit that referenced this pull request Oct 15, 2026
… (A9)

The PO asked for main's recursive-schema behaviour, for v7 and v8 sites
alike. Remove MAX_RECURSIVE_REF_REPEATS, the per-path repeat count and the
array-items `$ref` pass-through that came with it, and the tests that
pinned three levels. The following cherry-picks bring main's own fix
(#7899, #7903): a re-entered `$ref` is cut and expanded on demand.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
tlgimenes pushed a commit that referenced this pull request Oct 15, 2026
…pened (#7903)

#7899 stopped resolveSchema from re-expanding a `$ref` already on the
path, which fixed the hang on recursive commerce types but left the cut
node without `properties`/`items`. A recursive menu type
(`Item.children: Item[]`) therefore listed its child items but opened
each one as an empty form.

Mark the cut node with `recursiveRef` and expand it one level on demand
(`resolveSchemaRef` + cached `expandRecursiveSchema`) when renderField or
ArrayField reaches it, so the hang guard stays while nested levels remain
editable.

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit 6d8748d)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
tlgimenes added a commit that referenced this pull request Oct 15, 2026
Brings in 114 commits from main, including #7909 (PATCH decofile `expect`
fingerprints, 409 block-conflict, value-by-value block merge on sync) and
guitavano's #7899/#7903.

One conflict, in apps/api/src/decofile/commit-coalescer.ts: this branch
moved the gen-artifact regeneration and the commit message into
gen-artifact.ts (shared with hosted publish), while #7909 changed the
message to name only the accepted patches. The resolution keeps the shared
helpers and passes them #7909's accepted `set`/`del`, so the legacy and
Fast Preview write path behaves exactly as on main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
tlgimenes added a commit that referenced this pull request Oct 15, 2026
…ection

Brings in fold/v8-api, which now carries origin/main (114 commits),
including #7909 and #7918 (section forms start from a known version, saves
send `expect`, a stale save is refused with 409 and replayed or reloaded).

Conflicts resolved:
- use-save-block.ts: main's Fast Preview save (`base` -> `expect`, rebase
  on 409, BlockConflictError, no rollback on a conflict, `written`) moves
  into this branch's `writeLegacy`; the content-protocol path and SaveGuard
  stay as they were. `mutate`/`mutateAsync` keep main's `withBase` default
  and the hook keeps `reportError`.
- sections-editor.tsx: both form reloads stay (the content-epoch reload for
  discards/publishes and #7909's `reloadStaleForm`); main's form-base
  tracking, three-way merge, section following and retry-once are kept;
  failed saves use this branch's `reportError`.
- serve-save-error.ts: a BlockConflictError's own message (#7909's copy) is
  the toast headline on every backend, with no Details line.
- resolve-schema.ts and its cache test: #7899/#7903 were already
  cherry-picked here; this branch's lazy-block handling and A9 test stay.
- cms-header-actions.tsx / cms-panel-state.ts: main dropped
  cmsHeaderButtonLabels; the hosted header helpers stay.
- playwright.config.ts: both env additions (hosted env, GraphQL stub URL,
  BOARD_TRANSITION_SETTLE_SECONDS).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude PR authored by a coding agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant