Skip to content

Commit f2538a8

Browse files
neyser zananeyser zana
authored andcommitted
for master pull
1 parent 7288d3c commit f2538a8

File tree

5 files changed

+70
-37
lines changed

5 files changed

+70
-37
lines changed

build/webpack-bundle.js

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/webpack-bundle.js.map

Lines changed: 1 addition & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/GraphQLResponse.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React from 'react';
22
import ReactJson from 'react-json-view';
33

4-
const GraphQLResponse = ({ logs, log }) => {
4+
const GraphQLResponse = ({ logs, log }) => {
55

6-
let response = log=== null ? logs[logs.length - 1].res : log.res;
6+
let response = log === null ? logs[logs.length - 1].res : log.res;
77
console.log('--response:', response);
88

99
return (

src/components/TreeDiagram.jsx

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class TreeDiagram extends React.Component {
1111
orientation: 'vertical',
1212
foreignObjectWrapper: {y: -5, x: 10},
1313
nodeSize: {x: 75, y: 75},
14-
// domData: []
14+
domData: []
1515
};
1616
this.handleFlip = this.handleFlip.bind(this);
1717
}
@@ -26,36 +26,36 @@ class TreeDiagram extends React.Component {
2626
x: dimensions.width / 2,
2727
y: dimensions.height / 8
2828
},
29-
// domData: this.props.appState,
29+
domData: this.props.appState,
3030
});
3131
}
3232

3333
//* when theres a change in any of the toggles, filteredDdata stores the filtered components
3434
//* check for any toggles to be true, and filteredData to be not empty, if so setState.
3535
//* issue is we keep running into a repetitive recursive loop and app breaks/
36-
// componentDidUpdate() {
37-
// if(this.props.filteredData.length !== 0 && this.props.toggleRedux === true || this.props.toggleRouter === true || this.props.toggleApollo === true) {
38-
// this.setState({
39-
// domData: this.props.filteredData
40-
// });
41-
// }
42-
// }
36+
componentDidUpdate() {
37+
if(this.props.filteredData.length !== 0 && this.props.toggleRedux === true || this.props.toggleRouter === true || this.props.toggleApollo === true) {
38+
this.setState({
39+
domData: this.props.filteredData
40+
});
41+
}
42+
}
4343

4444
//* before props are being passed, we want to compare the old props with the newly updated props.
4545
//* if they're not the same (comparing lengths after filter) then we set our state accordingly.
4646
//* wanted to see diff from this and update.
4747

48-
// componentWillReceiveProps(nextProps) {
49-
// if(this.props.filteredData.length !== nextProps.filteredData.length) {
50-
// this.setState({
51-
// domData: this.props.filteredData
52-
// })
53-
// } else {
54-
// this.setState({
55-
// domData: this.props.appState
56-
// })
57-
// }
58-
// }
48+
componentWillReceiveProps(nextProps) {
49+
if(this.props.filteredData.length !== nextProps.filteredData.length) {
50+
this.setState({
51+
domData: this.props.filteredData
52+
})
53+
} else {
54+
this.setState({
55+
domData: this.props.appState
56+
})
57+
}
58+
}
5959

6060

6161
handleFlip() {

src/devtools.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class App extends Component {
2727
toggleRouter: false,
2828
toggleRedux: false,
2929
toggleApollo: false,
30-
// filteredData: []
30+
filteredData: [],
3131
logView: null
3232
};
3333

@@ -166,12 +166,12 @@ class App extends Component {
166166
//* best to have a toggle change a set of conditions in traverser, where if toggle is set to false, traverse and leave out these set of words apoloProvider etc.
167167
//* filtering data after its already arrived with two traverse functions seem constly, and is the cause of our glitch.
168168
//* throwing the filtering to dev and resetting appState is causing breakage, if cant find solution, go to the source of the issue, the traverser and set toggling conditions there.
169-
// this.setState({
170-
// filteredData: data
171-
// });
172169
this.setState({
173-
appState: data
170+
filteredData: data
174171
});
172+
// this.setState({
173+
// appState: data
174+
// });
175175
console.log(data, 'filterOutComponents function ran successfully, filteredData is set to this object --coming from devtools line 169')
176176
}
177177
}
@@ -310,12 +310,11 @@ class App extends Component {
310310
handleApolloFilter = {this.handleApolloFilter}
311311
handleReduxFilter = {this.handleReduxFilter}
312312
handleRouterFilter = {this.handleRouterFilter}
313-
// filteredData = {this.state.filteredData}
314-
// toggleRedux = {this.state.toggleRedux}
315-
// toggleRouter = {this.state.toggleRouter}
316-
// toggleApolo = {this.state.toggleApollo}
313+
filteredData = {this.state.filteredData}
314+
toggleRedux = {this.state.toggleRedux}
315+
toggleRouter = {this.state.toggleRouter}
316+
toggleApolo = {this.state.toggleApollo}
317317
/>
318-
<TreeDiagram appState={this.state.appState} handleMouseOver={this.handleMouseOver} />
319318
<StatePropsBox nodeData={this.state.nodeData} />
320319
</div>
321320
)}

0 commit comments

Comments
 (0)