Skip to content
This repository has been archived by the owner on May 14, 2020. It is now read-only.

Fixes issue #34 (Now correctly handles immutable objects when hideRoot is false) #36

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/JSONIterableNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function renderItemString({

// Returns the child nodes for each entry in iterable.
// If we have generated them previously we return from cache; otherwise we create them.
function getChildNodes({
export function getChildNodes({
data,
getItemString,
labelRenderer,
Expand Down
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@

import React from 'react';
import grabNode from './grab-node';
import objType from './obj-type';
import solarized from './themes/solarized';
import {getChildNodes} from './JSONObjectNode';
import { getChildNodes as getObjectChildNodes } from './JSONObjectNode';
import { getChildNodes as getIterableChildNodes } from './JSONIterableNode';

const styles = {
tree: {
Expand Down Expand Up @@ -77,6 +79,7 @@ export default class JSONTree extends React.Component {
} = this.props;

let nodeToRender;
let getChildNodes = objType(value) === 'Iterable' ? getIterableChildNodes : getObjectChildNodes;

if (!this.props.hideRoot) {
nodeToRender = grabNode({
Expand Down