Skip to content

Commit

Permalink
Only show node structure when there is no data
Browse files Browse the repository at this point in the history
  • Loading branch information
tibdex committed Sep 18, 2019
1 parent 193285c commit 8013d19
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/json-extension/src/component.tsx
Expand Up @@ -71,7 +71,14 @@ export class Component extends React.Component<IProps, IState> {
}}
invertTheme={false}
keyPath={[root]}
getItemString={() => null}
getItemString={(type, data, itemType) =>
((Array.isArray(data) && data) || Object.keys(data)).length ===
0 ? (
// When there is no data, we display the collection type ("{}" or "[]").
<span>{itemType}</span>
) : // Otherwise, the data speaks for itself.
null
}
labelRenderer={([label, type]) => {
// let className = 'cm-variable';
// if (type === 'root') {
Expand Down

0 comments on commit 8013d19

Please sign in to comment.