Repository navigation
fix(cms-studio): fix block-ref schema resolution for @decocms/start >=6.10 loaders - #4008
Merged
Merged
Conversation
…=6.10 loaders Two fixes for CMS Studio editing of sections that use loader props (e.g. SearchResult.page: ProductListingPage) in @decocms/start sites. resolve-schema.ts — extract resolveType from flat loader definitions @decocms/start >=6.10 generates loader definitions with __resolveType.enum directly in properties (not nested under allOf). The allRefs block in buildProperty was falling back to the base64 key instead of the real resolveType, causing duplicate entries in the AnyOf dropdown. Now also checks def.properties.__resolveType.enum directly. any-of-field.tsx — isolate loader breadcrumb from section breadcrumb When a user drills into an array item inside a loader config (e.g. selectedFacets Item 1), onBreadcrumbChange was propagating the loader- internal path (e.g. ['selectedFacets', '0']) to the outer section form. Since that path has no match in the section's top-level schema, the form showed all fields instead of the focused item. Module loaders now manage their breadcrumb state locally (loaderBreadcrumbs) so navigation inside a loader config stays self-contained. Related: DECO-5295, DECO-5296 Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
…item When user clicks an array item inside a loader config (e.g. selectedFacets Item 1 in SearchResult), the surrounding section fields (Seções Adicionais, Layout, etc.) were still visible because only the loader-internal breadcrumb changed but the outer section breadcrumb remained reset. Fix: when loaderBreadcrumbs becomes non-empty, also update the outer breadcrumb to focus on the loader field key (e.g. 'page'). This collapses the section form to show only the loader field, matching the old admin UX where clicking an array item shows a clean focused view with just that item's fields. When loaderBreadcrumbs returns to empty (user goes back), restore the outer breadcrumb to show the full section form again. Also: add 'key' to getArrayItemLabel fallback keys so SelectedFacet items show 'productClusterIds' instead of 'Item 1'. Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Replace the local loaderBreadcrumbs state hack with proper breadcrumb
path threading through AnyOfField in module-loader mode.
schema-form-breadcrumb.ts: extend resolveActiveFieldKeyInScope to also
match block-ref fields (loaders) by key or label. This allows a path
like ['page', 'productClusterIds'] to resolve 'page' at the SearchResult
level, enabling the outer form to collapse to just the loader field.
any-of-field.tsx: in module-loader mode, strip the loader field's own
key from breadcrumbPath before passing to the nested SchemaForm, and
prepend it back in nestedOnBreadcrumbChange when propagating up.
Full navigation flow:
user clicks 'productClusterIds' item in selectedFacets
→ ArrayField calls onBreadcrumbChange(['productClusterIds'])
→ AnyOfField prepends 'page': onBreadcrumbChange(['page', 'productClusterIds'])
→ section editor fieldBreadcrumbs = ['page', 'productClusterIds']
→ SearchResult SchemaForm resolves activeKey='page' (block-ref match)
→ shows only Página de Listagem, hides Seções Adicionais, Layout, etc.
→ AnyOfField strips 'page': nested SchemaForm gets ['productClusterIds']
→ loader SchemaForm resolves activeKey='selectedFacets' (item label match)
→ ArrayField shows only Key+Value for that item
Back navigation restores full form at each level.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
…ropdown When a loader's title is its file path (e.g. site/loaders/foo.ts), use labelFromResolveType to derive a human-readable name from the filename instead (e.g. DeliveryPromiseProductListingPage). Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
…adcrumb B1 — @hide block-ref fields appeared in the form. resolve-schema.ts buildProperty set 'hidden' only on the normal return path; the three block-ref early returns didn't propagate it. So hidden loader/block-ref props (e.g. SearchResult's tags/locationUser/stores, emitted by @decocms/start as { anyOf:[Resolvable, loaderRef], hide:'true' }) leaked into the UI as 'Select from saved'. Propagate hidden on all block-ref returns. Added resolve-schema test. B2 — breadcrumb showed the raw key 'page' instead of the field label. any-of-field.tsx now prepends the field's display label (e.g. 'Página de Listagem') to the breadcrumb in module-loader mode. resolveActiveFieldKey matches both label and key, so navigation still resolves. Related: DECO-5295 Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
In a Section[] prop (e.g. SearchResult.sections), items are Lazy-wrapped
(`{ __resolveType: '.../Lazy.tsx', section: {...} }`). getArrayItemLabel
labelled them 'Lazy' instead of the inner section (e.g.
'BannerCarrouselDepartment'). Unwrap the Lazy wrapper before deriving the
label.
Related: DECO-5297
Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
…s fix)
Nested section array items (e.g. SearchResult.sections) are stored
Lazy-wrapped: { __resolveType: '.../Lazy.tsx', section: { <real section> } }.
AnyOfField resolved the inner section's SCHEMA (via moduleResolveTypeFromBlockData)
but bound the form against the OUTER wrapper, so every field rendered empty even
when the inner section had data (e.g. BannerCarrouselDepartment.carrousels).
Add lazyWrappedInner() and bind the unwrapped inner section as the form value,
re-wrapping into the Lazy shape on change. Verified against bagaggio-tanstack
/ultimas-unidades-escolar: carrousels/title now bind; save preserves the Lazy
wrapper + sibling props.
Related: DECO-5297
Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
…ion name Some nested sections carry title: " " (a single space). getArrayItemLabel returned it verbatim, so the array item showed a blank, hard-to-click row (e.g. /bolsa-mochila SearchResult.sections → BannerCarrouselDepartment). Treat whitespace-only strings as empty and fall through to the section name, giving a visible label and a stable non-blank breadcrumb crumb. Related: DECO-5297 Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
…ext field Render data-only properties (present in page data but missing from _meta schema) by inferring schemas from runtime values, with hint propagation from the parent schema for format/title/description metadata. Add dedicated RichTextField component for rich-text/html string formats. Also fix breadcrumb path reset for module-loader unions and support schema inference for plain-array block-ref values. Co-Authored-By: Claude Opus 4.6 <[email protected]>
guitavano
force-pushed
the
cms-empty-form-bug
branch
from
June 19, 2026 15:53
13371c9 to
c965539
Compare
…e data inference - Strip HTML tags from rich-text fields in array item labels - Disambiguate block-refs with same label using loose matching on value keys - Render resolved plain arrays from block-ref fields as editable ArrayField - Remove data-only field inference (schema is the source of truth) Co-Authored-By: Claude Opus 4.6 <[email protected]>
…p, add tests - Add isSafeLinkUrl() to block javascript:/data:/vbscript: URLs in rich-text link handler - Reuse lazyWrappedInner() in array-item-display instead of inline detection - Extract inferBlockRefArrayItemSchema() into testable pure module - Add unit tests for link URL validation (11 cases) and array inference (8 cases) Co-Authored-By: Claude Opus 4.6 <[email protected]>
decocms Bot
pushed a commit
that referenced
this pull request
Jun 19, 2026
PR: #4008 fix(cms-studio): fix block-ref schema resolution for @decocms/start >=6.10 loaders Bump type: patch - decocms (apps/mesh/package.json): 3.36.6 -> 3.36.7 Deploy-Scope: web
tlgimenes
pushed a commit
that referenced
this pull request
Jul 16, 2026
…TS.md (#4475) Mined ~300 merged PRs for the delta between the first PR proposal and the work added before merge. The dominant shape: a first draft ships the happy path, then a hardening pass (often a different engineer who takes over the branch and merges — the vibecoder→engineer handoff) adds the same categories every time. Encoded those 9 categories as an actionable first-pass checklist, each citing a real PR (#4008, #4230, #4365, #4409, #4426, #4445, #4357, #4355, #4449, #4350, #4373, #4416, #4446, #4461, #4134, #4469). Covers: variant/edge-case handling, tenant/permission scoping, concurrency & silent-data-loss, test-per-fix + invert-bug-tests + real-PG, dead-code/knip, lifecycle symmetry + state reset, kill-switch/GC/git-exclude for risky infra, input validation vs over-engineering, compile-time type-safety. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
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.
Summary
Two fixes for CMS Studio editing of sections that use loader props (e.g.
SearchResult.page: ProductListingPage) in@decocms/startsites (bagaggio-tanstack, granadobr-tanstack).resolve-schema.ts— extract resolveType from flat loader definitions@decocms/start >=6.10generates loader definitions with__resolveType.enumdirectly inproperties(not nested underallOf). TheallRefsblock inbuildPropertywas falling back to the base64 definition key instead of the real resolveType (e.g.site/loaders/deliveryPromiseProductListingPage.ts), causing duplicate entries in the AnyOf dropdown.Now also checks
def.properties.__resolveType.enumdirectly, so the correct resolveType is extracted from flat definitions.any-of-field.tsx— isolate loader breadcrumb from section breadcrumbWhen a user drilled into an array item inside a loader config (e.g.
selectedFacets→ Item 1),onBreadcrumbChangepropagated the loader-internal path (e.g.['selectedFacets', '0']) to the outer section-editor breadcrumb. Since that path has no match in the section's top-level schema (SearchResult haspage,sections,layout… notselectedFacets), the form showed ALL fields instead of just the focused item.Module loaders now manage their breadcrumb state locally (
loaderBreadcrumbs) so navigation inside a loader config stays self-contained and doesn't pollute the outer form.Related
Test plan
🤖 Generated with Claude Code
Summary by cubic
Fixes CMS Studio editing for loader props in
@decocms/start6.10+: correct resolve types, hidden fields honored, predictable breadcrumbs, and clearer labels (including Lazy and rich‑text); adds a rich‑text editor, safe link handling, and editing for resolved plain arrays from block‑refs. Addresses DECO-5295, DECO-5296, and DECO-5297.Bug Fixes
properties.__resolveType.enumin flat loader defs to avoid base64$reffallback and duplicate AnyOf options.hiddenon all block-ref returns sohide: "true"props don’t show.keyas fallback; bind the unwrapped innersectionand re-wrap on change.ArrayField.javascript:,data:, andvbscript:.New Features
rich-text,rich-text-inline, andhtml.Written for commit c9649d3. Summary will update on new commits.