@@ -21,12 +21,11 @@ const root = '#d2f5e3';
2121//
2222
2323const clusterData = { } ;
24+ const selectorsCache = { }
2425
2526let isFired = false
2627function clusterDataPopulate ( props ) {
2728 let atomCompObj = reorganizedCompObj ( props ) ;
28- console . log ( props )
29- console . log ( atomCompObj )
3029
3130 //this is to set the root name property
3231 if ( props [ 0 ] . name ) {
@@ -39,14 +38,16 @@ function clusterDataPopulate(props) {
3938
4039 for ( let key in props [ 0 ] . atomSelectors ) {
4140 let outerobj = { }
42- outerobj . name = key
41+ outerobj . name = key
42+ selectorsCache [ key ] = true
4343
4444 if ( props [ 0 ] . atomSelectors [ key ] . length ) {
4545 for ( let i = 0 ; i < props [ 0 ] . atomSelectors [ key ] . length ; i ++ ) {
4646
4747 if ( ! outerobj . children ) outerobj . children = [ ]
4848 let innerobj = { }
4949 innerobj . name = props [ 0 ] . atomSelectors [ key ] [ i ]
50+ selectorsCache [ props [ 0 ] . atomSelectors [ key ] [ i ] ] = true
5051
5152 //if atoms contain components
5253 if ( atomCompObj [ props [ 0 ] . atomSelectors [ key ] [ i ] ] ) {
@@ -69,7 +70,19 @@ function clusterDataPopulate(props) {
6970 clusterData . children . push ( outerobj )
7071 }
7172 }
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+
7386 isFired = true
7487}
7588
0 commit comments