telus / tds-community

TELUS Design System Community Components
https://tds.telus.com/community/index.html
MIT License
28 stars 7 forks source link

TypeError when wrapping childless components in `<SkeletonProvider />`. #255

Open mujtabahasni opened 5 years ago

mujtabahasni commented 5 years ago

Description

If the <SkeletonProvider /> contains any childless components, it may cause a type error if the default children prop value is null. It should skip over any such components as there is no content to skeletonize.

Reproduction Steps

const ChildlLessComp = ({ children }) => {
 return (<span>Hello, World!</span))
}
ChildlessComp.propTypes = {
children: PropTypes.node
}

ChildlessComp.defaultProps = {
  children: null
}

const WrappedComp  = () => (
 <SkeletonProvider show={true}>
  <ChildLessComp skeleton>
</SkeletonProvider>
)

Workaround details

Do not wrap childless components.

Recommendation

Apply fix in PR: https://github.com/telus/tds-community/pull/254

Meta

varunj90 commented 5 years ago

hey @invalidred any updates on this issue?