Skip to content
This repository has been archived by the owner on Feb 7, 2022. It is now read-only.

Expanding Depth #5

Closed
liamdickson opened this issue May 29, 2015 · 4 comments
Closed

Expanding Depth #5

liamdickson opened this issue May 29, 2015 · 4 comments

Comments

@liamdickson
Copy link

Thanks for making this! It's been a great help in my chrome extension development.

Version 4.3.0 does not allow for deep expansion of JSON trees. Version 4.2.2 was not affected by this issue.

@Lapple
Copy link
Owner

Lapple commented May 29, 2015

Could you please provide some background for reproducing the case? I tried to supply nested JSON to the example app and expansion worked, screenshot.

@liamdickson
Copy link
Author

If that's the case it is most likely an issue on my end. I will contact you if I can get more information on the issue.

@liamdickson
Copy link
Author

I'm sorry for the delay. I've created an example that show the behavior I was trying to describe as well as some other strange behavior. It seems like if I try to change the data for the Inspector (by creating a new inspector) currently opened leaves will not update. If you reopen the leaf after updating the data then the data will update and if you open any children then the children will be updated.

var React = require('react');
var Inspector = require('react-json-inspector');
var data1 = { name: "name", description: "info", year: 2015, object: {data: 'some data', embeddedObject: {details: "some details"}} };
var data2 = { name: "another name", description: "more info", year: 2016, object: {data: 'some more data', embeddedObject: {details: "more details"}} };

var inspector1 = <Inspector data={ data1 } />;
var inspector2 = <Inspector data={ data2 } />;

var Wrapper = React.createClass({
    getInitialState: function() {
        return {
            switch: 0
        };
    },
    toggleSwitch: function () {
        this.setState({switch: !this.state.switch});
    },
    render: function () {
        if(this.state.switch){
            return <div><button onClick={this.toggleSwitch}>Toggle Data</button>{inspector1}</div>;
        }else{
            return <div><button onClick={this.toggleSwitch}>Toggle Data</button>{inspector2}</div>;
        }
    }
});

React.render(<Wrapper />,document.getElementById('inspector'));

Thank you again for your work on this!

@Lapple Lapple closed this as completed in 01bdcba Jun 8, 2015
@Lapple
Copy link
Owner

Lapple commented Jun 8, 2015

Thank you, the problem was that I have chosen incorrect key prop for inspector's leaf nodes. Now it is fixed and released as 5.0.3.

@Lapple Lapple mentioned this issue Jun 8, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants