@@ -29,7 +29,7 @@ class Tree {
29
29
* @param state : the tree's current state
30
30
* @param name : the tree's name
31
31
* @param componentData : Data in the component tree
32
- * @param parent generates a new tree (recursive call)
32
+ * @parent generates a new tree (recursive call)
33
33
*/
34
34
state : string | { } ;
35
35
@@ -68,7 +68,7 @@ class Tree {
68
68
cleanTreeCopy ( ) : Tree {
69
69
/**
70
70
* @object circularComponentTable : Clears circular component table only on first call, not recursive ones
71
- * @method clear clears component table
71
+ *
72
72
*/
73
73
//
74
74
if ( copyInstances === 0 ) {
@@ -97,6 +97,26 @@ class Tree {
97
97
copyInstances -- ;
98
98
return copy ;
99
99
}
100
+
101
+ // print out the tree structure in the console
102
+ // DEV: Process may be different for useState components
103
+ // BUG FIX: Don't print the Router as a component
104
+ // Change how the children are printed
105
+ // print() {
106
+ // const children = ['children: '];
107
+ // // DEV: What should we push instead for components using hooks (it wouldn't be state)
108
+ // // if this.children is always initialized to empty array, when would there ever be anything to iterate through here?
109
+ // this.children.forEach((child: any) => {
110
+ // children.push(child.state || child.component.state);
111
+ // });
112
+ // if (this.name) console.log('this.name if exists: ', this.name);
113
+ // if (children.length === 1) {
114
+ // console.log(`children length 1. ${this.state ? 'this.state: ' : 'this.component.state: '}`, this.state || this.component.state);
115
+ // } else console.log(`children length !== 1. ${this.state ? 'this.state: ' : 'this.component.state, children: '}`, this.state || this.component.state, ...children);
116
+ // this.children.forEach((child: any) => {
117
+ // child.print();
118
+ // });
119
+ // }
100
120
}
101
121
102
122
export default Tree ;
0 commit comments