Skip to content

Commit

Permalink
Check for empty object in basefeaturedetails
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Dec 21, 2020
1 parent eeb2283 commit 47900e1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/core/BaseFeatureWidget/BaseFeatureDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,10 @@ const Subfeature = (props: BaseProps) => {
)
}

function isEmpty(obj: Record<string, unknown>) {
return Object.keys(obj).length === 0
}

export const BaseFeatureDetails = observer((props: BaseInputProps) => {
const classes = useStyles()
const { model } = props
Expand All @@ -438,6 +442,10 @@ export const BaseFeatureDetails = observer((props: BaseInputProps) => {
return null
}
const feature = JSON.parse(JSON.stringify(model.featureData))

if (isEmpty(feature)) {
return null
}
return (
<Paper className={classes.paperRoot}>
<BaseCoreDetails feature={feature} {...props} />
Expand Down

0 comments on commit 47900e1

Please sign in to comment.