Repository navigation
fix(cms): stop recursive schema types from freezing the site editor - #7899
Merged
Merged
Conversation
Newer blocks-cli emits recursive commerce types as named definitions (Product → isVariantOf.hasVariant: Product[], ImageObject ↔ VideoObject). resolveSchema's cycle guard only covered union branches, so plain properties and array items re-expanded each re-entered $ref up to MAX_STRUCTURE_DEPTH, which hung the tab when the section list resolved its schemas. Skip the nested schema of a $ref already on the path, pass array items' $ref through so the guard sees it, and cache the schema the section list resolves per row. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
decocms Bot
pushed a commit
that referenced
this pull request
Oct 13, 2026
PR: #7899 fix(cms): stop recursive schema types from freezing the site editor Bump type: patch - decocms (apps/api/package.json): 4.477.0 -> 4.477.1 - @decocms/native (apps/native/package.json): 4.477.0 -> 4.477.1 Deploy-Scope: web
3 of 4 tasks
guitavano
added a commit
that referenced
this pull request
Oct 14, 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]>
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
…7899) * fix(cms): stop recursive schema types from freezing the site editor Newer blocks-cli emits recursive commerce types as named definitions (Product → isVariantOf.hasVariant: Product[], ImageObject ↔ VideoObject). resolveSchema's cycle guard only covered union branches, so plain properties and array items re-expanded each re-entered $ref up to MAX_STRUCTURE_DEPTH, which hung the tab when the section list resolved its schemas. Skip the nested schema of a $ref already on the path, pass array items' $ref through so the guard sees it, and cache the schema the section list resolves per row. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * test(cms): register the recursive-type fixture through a manifest $ref Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit ac12a70) 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this contribution about?
After a storefront bumps
@decocms/*from 7.71.x to 7.78.x, its regenerated.deco/meta.gen.jsonemits recursive commerce types as named definitions. Earlier versions inlined them. In these definitions,…/commerce.ts@Productreferences itself 6 times (for exampleisVariantOf.hasVariant: Product[]andisRelatedTo), and@ImageObjectand@VideoObjectreference each other. Opening the Site Editor on such a project froze the browser tab: first Chrome's "Page unresponsive" dialog, then "Aw, Snap! Error code 5" (out of memory).The cause is in
buildPropertyinresolve-schema.ts. Itsseencycle guard only gated union branch materialization. Plain structural descent (nestedpropertiesand arrayitems) re-expanded every re-entered$refuntilMAX_STRUCTURE_DEPTH(32). Arrayitems.$refwas resolved before the recursive call, so its key never reachedseen. With 3 or more self-references per level, the expansion never finishes in practice. The section list runsresolveSchemaper row to show the required-field dot, so the hang started as soon as the panel opened.Changes:
cyclicUnion→cyclicRef. When a$refis already on the current path,buildPropertystill emits the node (and a selector's option list) but skips its nestedproperties/items.itemsare passed tobuildPropertywith their$refintact, so the guard sees the item type. The{{…}}titleByis still read from the resolved definition.sectionHasMissingRequiredFieldusescachedResolveSchema, so a page with many product shelves resolves each section type once.How did you verify your code works?
resolveSchema – recursive data types (hang guard)toresolve-schema.test.ts. It uses a schema with the same structure asProduct/ImageObject/VideoObjectand asserts that the cycle is cut at the re-enteredProduct, both through an array item and through a nested object's array. On the previous code this test never finishes (killed after 30s); with the fix it passes.resolveSchemaover every manifest block (227) of an affected project'smeta.gen.json, before and after its dependency bump:bun test src/components/sections-editor/: 865 pass.bun run verify: 10883 pass, 0 fail.fmt:checkandlintare clean.Screenshots/Demonstration
No visual change. The editor now opens instead of freezing.
How to Test
.deco/meta.gen.jsonwas generated by@decocms/blocks-cli7.78.x and that has product shelf sections.Productrefers back to itself, the field shows as an object with no nested fields instead of expanding again.Review Checklist
🤖 Generated with Claude Code
Summary by cubic
Fixes the Site Editor freezing on schema types that reference themselves recursively, which started after a
@decocms/*bump regenerated.deco/meta.gen.jsonwith named recursive definitions likeProduct(self-referencing viaisVariantOf.hasVariant: Product[]) and mutual references betweenImageObjectandVideoObject.The cycle guard previously only gated union branch materialization, so plain property and array item descent re-expanded every re-entered
$refuntil the depth cap — enough to hang the browser tab when the section list resolved its schemas.Changes
$refs already on the current path now emit the node but skip nestedpropertiesanditems, for arrays and unions alike.$refs are passed through to the cycle guard instead of being resolved first.cachedResolveSchema, so each section type resolves once per page.Product/ImageObject/VideoObjectshape, registered through the manifest so it exercises the full section resolution path; it never finished on the previous code and passes now.Written for commit 876e2bc. Summary will update on new commits.