Skip to content

Commit 2050bf8

Browse files
committedMar 3, 2020
prevent html code example from crashing when children is array
1 parent 0c9bb29 commit 2050bf8

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed
 

‎packages/styleguide/src/components/Preview/CodeExample.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -167,18 +167,15 @@ export default class CodeExample extends React.Component {
167167
}
168168

169169
render() {
170-
const { children, codeJSXOptions, codeTypes, theme, ...other } = this.props;
170+
const { children, codeJSXOptions, codeTypes, ...other } = this.props;
171171

172172
let codeToShow;
173173
switch (this.state.codePreviewType) {
174174
case 'html':
175175
codeToShow = pretty(
176176
typeof children === 'string'
177177
? unescape(children)
178-
: renderToStaticMarkup({
179-
...children,
180-
props: { ...children.props, theme },
181-
}),
178+
: renderToStaticMarkup(children),
182179
{
183180
ocd: true,
184181
}

0 commit comments

Comments
 (0)