@@ -44,7 +44,6 @@ const clusterData : clusterShape = {};
44
44
const selectorsCache :selectorsCache = { } ;
45
45
const bothObj = { } ;
46
46
47
- console . log ( 'bothObj' , bothObj )
48
47
49
48
let initialFire = false
50
49
function clusterDataPopulate ( props :StateRouteProps ) {
@@ -144,14 +143,14 @@ function reorganizedCompObj(props) {
144
143
return reorganizedCompObj ;
145
144
}
146
145
147
- function Node ( { node, snapshots, dispatch} ) {
146
+ function Node ( { node, snapshots, dispatch, bothObj } ) {
148
147
// const [dispatch] = useStoreContext();
149
148
const selector = node . depth === 1 && node . height === 2
150
149
const isRoot = node . depth === 0 ;
151
150
const isParent = ! ! node . children ;
152
151
153
152
if ( isRoot ) return < RootNode node = { node } /> ;
154
- if ( selector ) return < SelectorNode node = { node } snapshots = { snapshots } /> ;
153
+ if ( selector ) return < SelectorNode node = { node } snapshots = { snapshots } bothObj = { bothObj } /> ;
155
154
156
155
return (
157
156
< Group top = { node . y } left = { node . x } >
@@ -161,6 +160,7 @@ function Node({ node, snapshots, dispatch}) {
161
160
fill = { isParent ? orange : blue }
162
161
stroke = { isParent ? orange : blue }
163
162
onMouseEnter = { ( ) => {
163
+ console . log ( bothObj )
164
164
console . log ( clusterData )
165
165
console . log ( snapshots [ 0 ] . recoilDomNode )
166
166
console . log ( node . data . name )
@@ -219,7 +219,7 @@ function RootNode({ node }) {
219
219
) ;
220
220
}
221
221
222
- function SelectorNode ( { node, snapshots, dispatch} ) {
222
+ function SelectorNode ( { node, snapshots, dispatch, bothObj } ) {
223
223
// const [dispatch] = useStoreContext();
224
224
return (
225
225
< Group top = { node . y } left = { node . x } >
@@ -229,6 +229,7 @@ function SelectorNode({ node, snapshots, dispatch}) {
229
229
fill = { selectWhite }
230
230
stroke = { selectWhite }
231
231
onMouseEnter = { ( ) => {
232
+ console . log ( bothObj )
232
233
console . log ( clusterData )
233
234
console . log ( snapshots [ 0 ] . recoilDomNode )
234
235
console . log ( node . data . name )
@@ -252,6 +253,15 @@ function SelectorNode({ node, snapshots, dispatch}) {
252
253
) ;
253
254
}
254
255
256
+ function removeDup ( bothObj ) {
257
+ let filteredObj = { }
258
+ for ( let key in bothObj ) {
259
+ let array = bothObj [ key ] . filter ( ( a , b ) => bothObj [ key ] . indexOf ( a ) === b )
260
+ filteredObj [ key ] = array
261
+ }
262
+ return filteredObj
263
+ }
264
+
255
265
const defaultMargin = { top : 40 , left : 0 , right : 0 , bottom : 40 } ;
256
266
257
267
// export type DendrogramProps = {
@@ -266,6 +276,10 @@ export default function AtomsRelationship({
266
276
margin = defaultMargin ,
267
277
snapshots,
268
278
} ) {
279
+
280
+
281
+ let filtered = removeDup ( bothObj )
282
+
269
283
const [ dispatch ] = useStoreContext ( ) ;
270
284
if ( ! initialFire ) {
271
285
clusterDataPopulate ( snapshots ) ;
@@ -302,6 +316,7 @@ export default function AtomsRelationship({
302
316
{ cluster . descendants ( ) . map ( ( node , i ) => (
303
317
< Node key = { `cluster-node-${ i } ` }
304
318
node = { node }
319
+ bothObj = { bothObj }
305
320
snapshots = { snapshots }
306
321
dispatch = { dispatch } />
307
322
) ) }
0 commit comments