Repository navigation
feat(visual-builder): send the Studio template with Start Editing (COMS-2635) - #681
deepak-kharah-cstk wants to merge 3 commits into
Conversation
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>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
🔒 Security Scan Results
⏱️ SLA Breach Summary
✅ BUILD PASSED - All security checks passed |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
…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>
🔒 Security Scan Results
⏱️ SLA Breach Summary
✅ 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>
🔒 Security Scan Results
⏱️ SLA Breach Summary
✅ BUILD PASSED - All security checks passed |
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.
compositionUid: thecomposable_uidof the Studio template that renders the page. It can come fromsetPageContext(), thewindow.__CS_PAGE_CONTEXT__global, or acontentstack:composition-uidmeta tag.composition_uid, so the editor opens that template instead of asking.setPageContext()without a template keeps the one the Studio SDK announces. A template for another entry, or for no entry, is never sent.compositionUidreaches the editor only through the Start Editing link, not theinithandshake or the page-context post message.docs/live-preview-configs.mddocuments 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.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
compositionUidin for Studio templates: contentstack/studio-sdk#1025. The field is optional, so existing sites are unaffected.🤖 Generated with Claude Code