@@ -68,29 +68,18 @@ function ActionContainer(props) {
68
68
//console.log("AC previos display: ", previousDisplay);
69
69
// diff function returns a comparison of two objects, one has an updated change
70
70
// 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
72
72
console . log ( 'AC delta' , delta ) ;
73
73
// return delta
74
74
const changedState = findStateChangeObj ( delta ) ;
75
75
//const previousDisplayState = findStateChangeObj(previousDisplay);
76
76
//return formatDeltaPopUp(changedState, previousDisplayState);
77
77
console . log ( 'AC Changed State: ' , changedState ) ;
78
+ const output = formatters . console . format ( changedState ) ;
79
+ console . log ( 'AC output :' , output ) ;
78
80
return changedState ;
79
81
}
80
82
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
-
94
83
function findStateChangeObj ( delta , changedState = [ ] ) {
95
84
if ( ! delta . children && ! delta . state ) {
96
85
// console.log('snapshot', snapshot);
@@ -104,8 +93,14 @@ function ActionContainer(props) {
104
93
return changedState ;
105
94
}
106
95
// 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 ;
108
102
}
103
+
109
104
// function to traverse state from hiararchy and also getting information on display name and component name
110
105
const displayArray = ( obj : {
111
106
stateSnapshot : { children : any [ ] } ;
0 commit comments