Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit 6270d62

Browse files
committed
fix: fixed nested structure with text
1 parent 68c799f commit 6270d62

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

example/stories/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ storiesOf('Basic', module)
1717
.add('flow', () => <SmartKnobedComponentWithFlow />)
1818
.add('nested example', () => (
1919
<div>
20-
<span />
20+
<h1>Title</h1>
2121
<SmartKnobedComponent />
2222
</div>
2323
))

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ const getNewProps = (target, context) => {
9797

9898
const mutateChildren = (component) => {
9999
return cloneElement(component, { children: Children.map(component.props.children, (child) => {
100-
if (child.type.__docgenInfo) {
100+
if (child.type && child.type.__docgenInfo) {
101101
const newProps = getNewProps(child)
102102

103103
return cloneElement(child, { ...child.props, ...newProps })
104104
}
105105

106-
if (child.props.children) {
106+
if (child.props && child.props.children) {
107107
return mutateChildren(child)
108108
}
109109

0 commit comments

Comments
 (0)