Skip to content

feat(visual-builder): send the Studio template with Start Editing (COMS-2635) - #681

Open
deepak-kharah-cstk wants to merge 3 commits into
develop_v4from
COMS-2635-start-editing-composition-uid
Open

deepak-kharah-cstk wants to merge 3 commits into
develop_v4from
COMS-2635-start-editing-composition-uid

Conversation

@deepak-kharah-cstk

@deepak-kharah-cstk deepak-kharah-cstk commented Nov 5, 2026 •

Copy link
Copy Markdown

Summary

COMS-2635. Two Studio templates can claim one content type. When a page is opened in the Visual Editor with Start Editing, the editor can't tell which one renders the page, so it asks.

  • The page context accepts an optional compositionUid: the composable_uid of the Studio template that renders the page. It can come from setPageContext(), the window.__CS_PAGE_CONTEXT__ global, or a contentstack:composition-uid meta tag.
  • Start Editing adds it to the Visual Editor link as composition_uid, so the editor opens that template instead of asking.
  • The template is taken from any source that names the same entry as the one that won, so a site calling setPageContext() without a template keeps the one the Studio SDK announces. A template for another entry, or for no entry, is never sent.
  • compositionUid reaches the editor only through the Start Editing link, not the init handshake or the page-context post message.
  • docs/live-preview-configs.md documents the new field, the meta tag and both rules above.

Testing

  • getVisualBuilderRedirectionUrl.test.ts: the link with and without a template, the same entry from two sources, a template for a different entry, no entry, an empty entry meta tag.
  • resolvePageContext.test.ts (new): setPageContext() > page global > meta tags for the entry and content type. Swapping the order fails these tests.
  • Full suite passes.

Merge order

Independent of the other COMS-2599 PRs: the Visual Editor already reads composition_uid. contentstack/visual-builder#2938 adds the template picker this link skips.

Related

The Studio SDK fills compositionUid in for Studio templates: contentstack/studio-sdk#1025. The field is optional, so existing sites are unaffected.


🤖 Generated with Claude Code

The page context accepts an optional compositionUid, the composable_uid
of the Studio template that renders the page, from setPageContext(), the
window.__CS_PAGE_CONTEXT__ global or a contentstack:composition-uid meta
tag. Start Editing adds it to the Visual Editor link as composition_uid,
so the editor opens that template instead of asking which one when
several claim the content type. The template is read only from the
source that named the entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@deepak-kharah-cstk
deepak-kharah-cstk requested a review from a team as a code owner November 5, 2026 06:27
@snyk-io

snyk-io Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 2 0 10 ✅ Passed
🟠 High Severity 2 0 25 ✅ Passed
🟡 Medium Severity 1 0 500 ✅ Passed
🔵 Low Severity 1 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 68.85% 2609 / 3789
🔵 Statements 67.74% 2653 / 3916
🔵 Functions 66.52% 473 / 711
🔵 Branches 63.18% 1577 / 2496
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/preview/contentstack-live-preview-HOC.ts 94.11% 86.2% 100% 94.11% 81, 245-249
src/types/types.ts 100% 100% 100% 100%
src/visualBuilder/utils/getVisualBuilderRedirectionUrl.ts 100% 100% 100% 100%
src/visualBuilder/utils/resolvePageContext.ts 100% 100% 100% 100%
Generated in workflow #970 for commit 0f39b63 by the Vitest Coverage Report Action

Comment thread docs/live-preview-configs.md Resolved
…he entry

Review fixes for COMS-2635.

- The template is taken from any source naming the same entry as the
  one that won, so a site calling setPageContext() without a template
  keeps the one the Studio SDK announces. A template for another entry,
  or for no entry (including an empty entry meta tag), is never sent.
- Tests pin the setPageContext > page global > meta tag precedence for
  the entry and content type.
- Meta-tag sources are typed for exactOptionalPropertyTypes, so the
  declaration build no longer fails on them.
- composition_uid is a plain string like the other params.
- Docs say when compositionUid is used and that it reaches the editor
  only through the Start Editing link.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 2 0 10 ✅ Passed
🟠 High Severity 2 0 25 ✅ Passed
🟡 Medium Severity 1 0 500 ✅ Passed
🔵 Low Severity 1 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

…CONTEXT sends

- An empty compositionUid no longer hides a template another source
  announces for the same entry.
- A test pins that PAGE_CONTEXT carries only the entry and content type,
  so the template reaches the editor only through Start Editing.
- The window.__CS_PAGE_CONTEXT__ docs example shows compositionUid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 2 0 10 ✅ Passed
🟠 High Severity 2 0 25 ✅ Passed
🟡 Medium Severity 1 0 500 ✅ Passed
🔵 Low Severity 1 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

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.

2 participants