Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Editing Integration] Metadata for root placeholder should use empty/default GUID #1814

Merged
merged 6 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Our versioning strategy is as follows:

### 🛠 Breaking Change

* Editing Integration Support: ([#1776](https://github.com/Sitecore/jss/pull/1776))([#1792](https://github.com/Sitecore/jss/pull/1792))([#1773](https://github.com/Sitecore/jss/pull/1773))([#1797](https://github.com/Sitecore/jss/pull/1797))([#1800](https://github.com/Sitecore/jss/pull/1800))([#1803](https://github.com/Sitecore/jss/pull/1803))([#1806](https://github.com/Sitecore/jss/pull/1806))([#1809](https://github.com/Sitecore/jss/pull/1809))
* Editing Integration Support: ([#1776](https://github.com/Sitecore/jss/pull/1776))([#1792](https://github.com/Sitecore/jss/pull/1792))([#1773](https://github.com/Sitecore/jss/pull/1773))([#1797](https://github.com/Sitecore/jss/pull/1797))([#1800](https://github.com/Sitecore/jss/pull/1800))([#1803](https://github.com/Sitecore/jss/pull/1803))([#1806](https://github.com/Sitecore/jss/pull/1806))([#1809](https://github.com/Sitecore/jss/pull/1809)) ([#1814](https://github.com/Sitecore/jss/pull/1814))
* `[sitecore-jss-react]` Introduces `PlaceholderMetadata` component which supports the hydration of chromes on Pages by rendering the components and placeholders with required metadata.
* `[sitecore-jss]` Chromes are hydrated based on the basis of new `editMode` property derived from LayoutData, which is defined as an enum consisting of `metadata` and `chromes`.
* `ComponentConsumerProps` is removed. You might need to reuse `WithSitecoreContextProps` type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,6 @@ describe('PlaceholderMetadata', () => {
},
route: {
name: 'main',
uid: 'root123',
placeholders: {
main: [
{
Expand Down Expand Up @@ -842,7 +841,7 @@ describe('PlaceholderMetadata', () => {

expect(wrapper.html()).to.equal(
art-alexeyenko marked this conversation as resolved.
Show resolved Hide resolved
[
'<code type="text/sitecore" chrometype="placeholder" class="scpm" kind="open" id="main_root123"></code>',
'<code type="text/sitecore" chrometype="placeholder" class="scpm" kind="open" id="main_00000000-0000-0000-0000-000000000000"></code>',
'<code type="text/sitecore" chrometype="rendering" class="scpm" kind="open" id="nested123"></code>',
'<div class="header-wrapper">',
'<code type="text/sitecore" chrometype="placeholder" class="scpm" kind="open" id="logo_nested123"></code>',
Expand All @@ -868,7 +867,6 @@ describe('PlaceholderMetadata', () => {
},
route: {
name: 'main',
uid: 'root123',
placeholders: {
main: [],
},
Expand All @@ -885,7 +883,7 @@ describe('PlaceholderMetadata', () => {
expect(wrapper.html()).to.equal(
[
'<div class="sc-jss-empty-placeholder">',
'<code type="text/sitecore" chrometype="placeholder" class="scpm" kind="open" id="main_root123"></code>',
'<code type="text/sitecore" chrometype="placeholder" class="scpm" kind="open" id="main_00000000-0000-0000-0000-000000000000"></code>',
'<code type="text/sitecore" chrometype="placeholder" class="scpm" kind="close"></code>',
'</div>',
].join('')
Expand All @@ -901,7 +899,6 @@ describe('PlaceholderMetadata', () => {
},
route: {
name: 'main',
uid: 'root123',
placeholders: {
main: [
{
Expand All @@ -922,7 +919,7 @@ describe('PlaceholderMetadata', () => {

expect(wrapper.html()).to.equal(
[
'<code type="text/sitecore" chrometype="placeholder" class="scpm" kind="open" id="main_root123"></code>',
'<code type="text/sitecore" chrometype="placeholder" class="scpm" kind="open" id="main_00000000-0000-0000-0000-000000000000"></code>',
'<code type="text/sitecore" chrometype="rendering" class="scpm" kind="open" id="123"></code>',
'<div style="background:darkorange;outline:5px solid orange;padding:10px;color:white;max-width:500px"><h2>Unknown</h2><p>JSS component is missing React implementation. See the developer console for more information.</p></div>',
'<code type="text/sitecore" chrometype="rendering" class="scpm" kind="close"></code>',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export type CodeBlockAttributes = {
* @returns {JSX.Element} A React fragment containing open and close code blocks surrounding the children elements.
*/
export const PlaceholderMetadata = ({
uid,
uid = '00000000-0000-0000-0000-000000000000',
illiakovalenko marked this conversation as resolved.
Show resolved Hide resolved
addy-pathania marked this conversation as resolved.
Show resolved Hide resolved
placeholderName,
children,
}: PlaceholderMetadataProps): JSX.Element => {
Expand Down