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

[sitecore-jss-react] Error rendering raw self-closing tag elements in placeholders #745

Merged
merged 1 commit into from
Jul 13, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,13 @@ export class PlaceholderCommon<T extends PlaceholderProps> extends React.Compone
const props: {
[attr: string]: unknown;
key?: string;
dangerouslySetInnerHTML: {
dangerouslySetInnerHTML?: {
__html: string | null;
};
} = {
...baseProps,
...attributes,
dangerouslySetInnerHTML: { __html: elem.contents },
dangerouslySetInnerHTML: elem.contents ? { __html: elem.contents } : undefined,
};

/* Since we can't set the "key" attribute via React, stash it
Expand Down
8 changes: 8 additions & 0 deletions packages/sitecore-jss-react/src/testData/ee-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ export const convertedData = {
params: {},
placeholders: {
'page-header': [
{
name: 'img',
type: 'text/sitecore',
contents: '',
attributes: {
src: '/test.png',
},
},
{
name: 'code',
type: 'text/sitecore',
Expand Down