Skip to content

feat(pages): add site pages editor with schema viewer and live preview#3101

Open
aka-sacci-ccr wants to merge 3 commits intomainfrom
feat-site-editor-forms
Open

feat(pages): add site pages editor with schema viewer and live preview#3101
aka-sacci-ccr wants to merge 3 commits intomainfrom
feat-site-editor-forms

Conversation

@aka-sacci-ccr
Copy link
Copy Markdown
Contributor

@aka-sacci-ccr aka-sacci-ccr commented Apr 10, 2026

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

What is this contribution about?

Describe your changes and why they're needed.

Screenshots/Demonstration

Add screenshots or a Loom video if your changes affect the UI.

How to Test

Provide step-by-step instructions for reviewers to test your changes:

  1. Step one
  2. Step two
  3. Expected outcome

Migration Notes

If this PR requires database migrations, configuration changes, or other setup steps, document them here. Remove this section if not applicable.

Review Checklist

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

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

    • New "Pages" view wired into navigation; lists pages from .decofile with search/filter (no MCP round-trip).
    • Schema viewer in the thick sidebar using a new SchemaResolver that resolves $ref, allOf, anyOf, saved blocks, and unwraps Lazy/SingleDeferred (shows an "Async" badge).
    • Readonly form rendering for section schemas using @deco/ui (string, number, boolean, enum, object, array, union).
    • Live preview iframe with editable URL bar, refresh, open-in-new-tab, and Inspect mode that injects hover overlays and expands the matching section on click (ignores layout header/footer).
    • Sidebar integration: deco projects get a "Pages" entry; when a page is open, the sidebar switches to the Sections panel.
    • Shared hooks (useDecofile, useSiteMeta) with @tanstack/react-query caching; integrates with @decocms/mesh-sdk, @deco/ui, and @untitledui/icons.
  • Bug Fixes

    • openMainView now clears id/toolName when switching views to prevent stale params.

Written for commit cfd5789. Summary will update on new commits.

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
@github-actions
Copy link
Copy Markdown
Contributor

🧪 Benchmark

Should we run the Virtual MCP strategy benchmark for this PR?

React with 👍 to run the benchmark.

Reaction Action
👍 Run quick benchmark (10 & 128 tools)

Benchmark will run on the next push after you react.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

Release Options

Suggested: Minor (2.259.0) — based on feat: prefix

React with an emoji to override the release type:

Reaction Type Next Version
👍 Prerelease 2.258.1-alpha.1
🎉 Patch 2.258.1
❤️ Minor 2.259.0
🚀 Major 3.0.0

Current version: 2.258.0

Note: If multiple reactions exist, the smallest bump wins. If no reactions, the suggested bump is used (default: patch).

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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} />
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Fix with Cubic

decobot added 2 commits April 10, 2026 16:29
…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
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant