fix: resolve documentTypeUnique for Block Grid nested in an element type (#293, #291)#309
Merged
rickbutterfield merged 2 commits intoJul 1, 2026
Conversation
…ype (#293, #291) A Block Grid preview resolves two independent values: the nodeKey (the document being previewed) and the documentTypeUnique (the content type that declares the block-editor property). Since #297 the content-workspace lookup passes beyond alias matches to reach the root document, which is correct for nodeKey but wrong for documentTypeUnique when the Block Grid property lives on an element type nested inside another block: it resolved the root document type, so the server could not find the property alias on it and returned "The property type is invalid." Resolve documentTypeUnique from the nearest block workspace's element content type when the preview is nested, falling back to the document type at top level. nodeKey resolution is unchanged (#297 preserved). The fix is Block Grid only: the list, single and rich-text render paths do not use documentTypeUnique. Adds web-test-runner coverage (nested, non-nested, and late-arriving block workspace ordering) and wires the frontend test suite into CI - a new ci.yml runs both the frontend and .NET suites on push/PR to the long-lived branches, and release.yml now runs the frontend tests before publishing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Block Grid preview requests when a Block Grid is nested inside an element type by resolving documentTypeUnique from the nearest block workspace’s owning element content type (while keeping nodeKey resolution rooted at the document workspace). It also adds regression tests for the nested owner-type behavior and introduces/updates GitHub Actions workflows to run frontend and .NET test suites in CI and release.
Changes:
- Resolve
documentTypeUniquefrom the nearest block workspace (element type) for nested Block Grid previews, with re-render on late owner-type arrival. - Add regression tests covering nested vs non-nested owner content type resolution (including late-arriving block workspace).
- Add a CI workflow and update the release workflow to run frontend tests (including Playwright browser install) alongside .NET build/tests.
Reviewed changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Umbraco.Community.BlockPreview/wwwroot/App_Plugins/Umbraco.Community.BlockPreview/index.js | Rebuilt plugin bundle including the nested owner content-type resolution behavior. |
| src/Umbraco.Community.BlockPreview.UI/src/blockEditor/block-preview-base.element.ts | Adds owner content type observation and prefers it for documentTypeUnique when available. |
| src/Umbraco.Community.BlockPreview.UI/src/blockEditor/block-grid-preview.custom-view.element.ts | Hooks owner content type observation into Block Grid preview setup. |
| src/Umbraco.Community.BlockPreview.UI/src/blockEditor/nested-owner-contenttype-resolution.test.ts | New regression tests for nested owner content type resolution (and late-arrival correction). |
| .github/workflows/release.yml | Runs Playwright install + frontend tests before building/publishing. |
| .github/workflows/ci.yml | New CI workflow running frontend build/tests and .NET build/tests on pushes/PRs to long-lived branches. |
Files not reviewed (1)
- src/Umbraco.Community.BlockPreview/wwwroot/App_Plugins/Umbraco.Community.BlockPreview/index.js: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- ci.yml: add least-privilege 'permissions: contents: read' (CodeQL). - nested-owner-contenttype-resolution.test.ts: stub fetchStylesheets() so the grid preview test doesn't make a real HTTP request (Copilot). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Fixes the
The property type is invalid.error when previewing a Block Grid nested inside an element type (issues #293 nested-element regression and #291).A Block Grid preview needs two independent values:
nodeKey→ the document being previewed (the page)documentTypeUnique→ the content type that declares the block-editor propertySince #297 the content-workspace lookup uses
passContextAliasMatchesto reach the root document. That is correct fornodeKey, but for a Block Grid property declared on a nested element type it resolved the root document type — which doesn't declare the nested property alias — so the server returnedThe property type is invalid.Fix
documentTypeUniquefrom the nearest block workspace's element content type when nested, falling back to the document type at top level (observeOwnerContentTypein the shared base element).nodeKeyresolution is unchanged, so Fails getting nodeKey in nested block lists #297 stays intact.documentTypeUnique, so they're deliberately untouched.Tests
nested-owner-contenttype-resolution.test.ts: nested resolves to the element type, non-nested resolves to the document type, and a late-arriving block workspace correctly re-resolves.CI
ci.ymlruns the frontend (npm test) and .NET (dotnet test) suites on push/PR tov5/dev,v5/main,v6/dev,v6/main— previously the frontend tests ran nowhere and .NET tests ran only at release.release.ymlnow runs the frontend tests before publishing.🤖 Generated with Claude Code