feat(pages): add site pages editor with schema viewer and live preview#3101
feat(pages): add site pages editor with schema viewer and live preview#3101aka-sacci-ccr wants to merge 3 commits intomainfrom
Conversation
Introduce a Pages view for deco sites with: - Pages list derived client-side from .decofile (no MCP round-trip) - Section schema viewer in the thick sidebar (SchemaResolver parses _meta) - Live iframe preview with editable URL bar in the main content area - Shared data hooks (useDecofile, useSiteMeta) with React Query caching - Search/filter on the pages list - Fix openMainView to properly clear id/toolName on navigation Made-with: Cursor
🧪 BenchmarkShould we run the Virtual MCP strategy benchmark for this PR? React with 👍 to run the benchmark.
Benchmark will run on the next push after you react. |
Release OptionsSuggested: Minor ( React with an emoji to override the release type:
Current version:
|
There was a problem hiding this comment.
1 issue found across 6 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/mesh/src/web/views/pages/index.tsx">
<violation number="1" location="apps/mesh/src/web/views/pages/index.tsx:253">
P1: When `pageKey` changes, `previewPath` and `pathInput` remain stale because `useState(initialPath)` only captures the value at mount time. Add `key={pageKey}` where `PagePreviewView` is rendered to force a remount and reinitialize state for the new page.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| </div> | ||
| } | ||
| > | ||
| <PagePreviewView envUrl={envUrl} pageKey={pageKey} /> |
There was a problem hiding this comment.
P1: When pageKey changes, previewPath and pathInput remain stale because useState(initialPath) only captures the value at mount time. Add key={pageKey} where PagePreviewView is rendered to force a remount and reinitialize state for the new page.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/mesh/src/web/views/pages/index.tsx, line 253:
<comment>When `pageKey` changes, `previewPath` and `pathInput` remain stale because `useState(initialPath)` only captures the value at mount time. Add `key={pageKey}` where `PagePreviewView` is rendered to force a remount and reinitialize state for the new page.</comment>
<file context>
@@ -0,0 +1,724 @@
+ </div>
+ }
+ >
+ <PagePreviewView envUrl={envUrl} pageKey={pageKey} />
+ </Suspense>
+ );
</file context>
…n support Resolve saved blocks (e.g. "Footer") by looking up their real __resolveType in the decofile. Unwrap Lazy/SingleDeferred wrappers to display the inner section's schema with an "Async" badge. Replace the raw FieldDescriptor debug tree with proper readonly form inputs (string, number, boolean, enum, object, array, union) using @deco/ui components. Made-with: Cursor
Inject hover overlays into the preview iframe via postMessage. Clicking a section sends its manifest key back to the parent, which matches it against the sidebar's unwrapped resolveTypes to expand the correct section card. Sections outside the page (header/footer from layout) are gracefully ignored. Made-with: Cursor
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/mesh/src/web/views/pages/index.tsx">
<violation number="1" location="apps/mesh/src/web/views/pages/index.tsx:500">
P2: Inspect-mode section selection is incorrect for duplicate section types because `resolveType` is treated as unique.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| const handler = (e: Event) => { | ||
| const { manifestKey } = (e as CustomEvent<{ manifestKey: string }>) | ||
| .detail; | ||
| const idx = resolveTypeToIndex.get(manifestKey); |
There was a problem hiding this comment.
P2: Inspect-mode section selection is incorrect for duplicate section types because resolveType is treated as unique.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/mesh/src/web/views/pages/index.tsx, line 500:
<comment>Inspect-mode section selection is incorrect for duplicate section types because `resolveType` is treated as unique.</comment>
<file context>
@@ -404,6 +480,36 @@ export function PageSectionsPanel({
+ const handler = (e: Event) => {
+ const { manifestKey } = (e as CustomEvent<{ manifestKey: string }>)
+ .detail;
+ const idx = resolveTypeToIndex.get(manifestKey);
+ if (idx == null) return;
+ setExpandedIndex(idx);
</file context>
Introduce a Pages view for deco sites with:
Made-with: Cursor
What is this contribution about?
Screenshots/Demonstration
How to Test
Migration Notes
Review Checklist
Summary by cubic
Adds a Pages editor for deco sites with a schema viewer, live preview, and an inspect mode that links clicks in the preview to the correct section in the sidebar. Resolves saved blocks and lazy sections, and renders readonly form fields.
New Features
.decofilewith search/filter (no MCP round-trip).SchemaResolverthat resolves$ref,allOf,anyOf, saved blocks, and unwrapsLazy/SingleDeferred(shows an "Async" badge).@deco/ui(string, number, boolean, enum, object, array, union).useDecofile,useSiteMeta) with@tanstack/react-querycaching; integrates with@decocms/mesh-sdk,@deco/ui, and@untitledui/icons.Bug Fixes
openMainViewnow clearsid/toolNamewhen switching views to prevent stale params.Written for commit cfd5789. Summary will update on new commits.