@@ -21,12 +21,11 @@ const root = '#d2f5e3';
21
21
//
22
22
23
23
const clusterData = { } ;
24
+ const selectorsCache = { }
24
25
25
26
let isFired = false
26
27
function clusterDataPopulate ( props ) {
27
28
let atomCompObj = reorganizedCompObj ( props ) ;
28
- console . log ( props )
29
- console . log ( atomCompObj )
30
29
31
30
//this is to set the root name property
32
31
if ( props [ 0 ] . name ) {
@@ -39,14 +38,16 @@ function clusterDataPopulate(props) {
39
38
40
39
for ( let key in props [ 0 ] . atomSelectors ) {
41
40
let outerobj = { }
42
- outerobj . name = key
41
+ outerobj . name = key
42
+ selectorsCache [ key ] = true
43
43
44
44
if ( props [ 0 ] . atomSelectors [ key ] . length ) {
45
45
for ( let i = 0 ; i < props [ 0 ] . atomSelectors [ key ] . length ; i ++ ) {
46
46
47
47
if ( ! outerobj . children ) outerobj . children = [ ]
48
48
let innerobj = { }
49
49
innerobj . name = props [ 0 ] . atomSelectors [ key ] [ i ]
50
+ selectorsCache [ props [ 0 ] . atomSelectors [ key ] [ i ] ] = true
50
51
51
52
//if atoms contain components
52
53
if ( atomCompObj [ props [ 0 ] . atomSelectors [ key ] [ i ] ] ) {
@@ -69,7 +70,19 @@ function clusterDataPopulate(props) {
69
70
clusterData . children . push ( outerobj )
70
71
}
71
72
}
72
- console . log ( clusterData )
73
+
74
+ for ( let key in atomCompObj ) {
75
+ let outObj = { } ;
76
+ if ( ! selectorsCache [ key ] ) {
77
+ outObj . name = key
78
+ for ( let i = 0 ; i < atomCompObj [ key ] . length ; i ++ ) {
79
+ if ( ! outObj . children ) outObj . children = [ ]
80
+ outObj . children . push ( { name :atomCompObj [ key ] [ i ] } )
81
+ }
82
+ clusterData . children . push ( outObj )
83
+ }
84
+ }
85
+
73
86
isFired = true
74
87
}
75
88
0 commit comments