Skip to content

Commit f40e533

Browse files
committed
nice
1 parent da176f4 commit f40e533

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

src/app/containers/ActionContainer.tsx

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,29 +68,18 @@ function ActionContainer(props) {
6868
//console.log("AC previos display: ", previousDisplay);
6969
// diff function returns a comparison of two objects, one has an updated change
7070
// just displays stateful data
71-
const delta = diff(previousDisplay, snapshots[index]);
71+
const delta = diff(previousDisplay, snapshots[index]); //I dont htink stateless cleaning is necissary
7272
console.log('AC delta', delta);
7373
// return delta
7474
const changedState = findStateChangeObj(delta);
7575
//const previousDisplayState = findStateChangeObj(previousDisplay);
7676
//return formatDeltaPopUp(changedState, previousDisplayState);
7777
console.log('AC Changed State: ', changedState);
78+
const output = formatters.console.format(changedState);
79+
console.log('AC output :', output);
7880
return changedState;
7981
}
8082

81-
// function findStateChangeObj2(delta, changedState = []) {
82-
// while (delta.children) {
83-
// Object.keys(delta.children).forEach((child) => {
84-
// if (child.state && child.state[0] !== "stateless") {
85-
// console.log('stateful child: ', child);
86-
// changedState.push(child.state);
87-
// }
88-
// return changedState.push(findStateChangeObj2(child, changedState));
89-
// });
90-
// }
91-
// return changedState;
92-
// }
93-
9483
function findStateChangeObj(delta, changedState = []) {
9584
if (!delta.children && !delta.state) {
9685
// console.log('snapshot', snapshot);
@@ -104,8 +93,14 @@ function ActionContainer(props) {
10493
return changedState;
10594
}
10695
// console.log('snapshot outside if', snapshot);
107-
return findStateChangeObj(delta.children[0], changedState);
96+
Object.keys(delta.children).forEach((child) => {
97+
//if (isNaN(child) === false) {
98+
changedState.push(...findStateChangeObj(delta.children[child]));
99+
//}
100+
});
101+
return changedState;
108102
}
103+
109104
// function to traverse state from hiararchy and also getting information on display name and component name
110105
const displayArray = (obj: {
111106
stateSnapshot: { children: any[] };

0 commit comments

Comments
 (0)