@@ -241,6 +241,7 @@ const TreeDisplay: React.FC<TreeDisplayProps> = ({ systemState, width, height })
241
241
const tr = d3 . transition ( ) . duration ( 1000 ) . ease ( d3 . easeCubicInOut ) ;
242
242
243
243
const balancerGroup = wholeGraph . select ( "g.balancers" ) ;
244
+ // TODO: add key function to data join when balancer ids are stable
244
245
const balancerCircles = balancerGroup . selectAll ( ".balancer" ) . data ( balancerNodes ) ;
245
246
balancerCircles
246
247
. join (
@@ -261,7 +262,10 @@ const TreeDisplay: React.FC<TreeDisplayProps> = ({ systemState, width, height })
261
262
. attr ( "cx" , d => d . x )
262
263
. attr ( "cy" , d => d . y )
263
264
. attr ( "r" , NODE_RADIUS + 10 ) ;
264
- const balancerTexts = balancerGroup . selectAll ( ".balancer-text" ) . data ( balancerNodes ) ;
265
+ const balancerTexts = balancerGroup
266
+ . selectAll ( ".balancer-text" )
267
+ // TODO: add key function to data join when balancer ids are stable
268
+ . data ( balancerNodes ) ;
265
269
balancerTexts
266
270
. join (
267
271
create =>
@@ -286,7 +290,9 @@ const TreeDisplay: React.FC<TreeDisplayProps> = ({ systemState, width, height })
286
290
287
291
// create groups for all the monoliths
288
292
const monolithGroup = wholeGraph . select ( "g.monoliths" ) ;
289
- const monolithGroups = monolithGroup . selectAll ( "g.monolith" ) . data ( monolithNodes ) ;
293
+ const monolithGroups = monolithGroup
294
+ . selectAll ( "g.monolith" )
295
+ . data ( monolithNodes , ( d : any ) => d . id ) ;
290
296
// for debugging, draw the bounding boxes of the monolith trees
291
297
if ( DEBUG_BOUNDING_BOXES ) {
292
298
monolithGroups
@@ -310,7 +316,9 @@ const TreeDisplay: React.FC<TreeDisplayProps> = ({ systemState, width, height })
310
316
. y ( ( d : any ) => d . y ) ;
311
317
312
318
const monolith = d3 . select ( this ) ;
313
- const monolithLinks = monolith . selectAll ( ".treelink" ) . data ( d . tree . links ( ) ) ;
319
+ const monolithLinks = monolith
320
+ . selectAll ( ".treelink" )
321
+ . data ( d . tree . links ( ) , ( d : any ) => d . source ?. data ?. id + d . target ?. data ?. id ) ;
314
322
monolithLinks
315
323
. join (
316
324
create => create . append ( "path" ) . attr ( "class" , "treelink" ) ,
@@ -327,7 +335,7 @@ const TreeDisplay: React.FC<TreeDisplayProps> = ({ systemState, width, height })
327
335
328
336
const monolithCircles = monolith
329
337
. selectAll ( ".monolith" )
330
- . data ( d . tree . descendants ( ) ) ;
338
+ . data ( d . tree . descendants ( ) , ( d : any ) => d . data ?. id ) ;
331
339
monolithCircles
332
340
. join (
333
341
create =>
@@ -350,7 +358,7 @@ const TreeDisplay: React.FC<TreeDisplayProps> = ({ systemState, width, height })
350
358
351
359
const monolithTexts = monolith
352
360
. selectAll ( ".monolith-text" )
353
- . data ( d . tree . descendants ( ) ) ;
361
+ . data ( d . tree . descendants ( ) , ( d : any ) => d . data ?. id ) ;
354
362
monolithTexts
355
363
. join (
356
364
create =>
@@ -391,7 +399,9 @@ const TreeDisplay: React.FC<TreeDisplayProps> = ({ systemState, width, height })
391
399
} ;
392
400
} ) ;
393
401
} ) ;
394
- const balancerMonolithLinks = gb2mLinks . selectAll ( ".b2m-link" ) . data ( b2mLinkData ) ;
402
+ const balancerMonolithLinks = gb2mLinks
403
+ . selectAll ( ".b2m-link" )
404
+ . data ( b2mLinkData , ( d : any ) => d . source ?. data ?. id + d . target ?. data ?. id ) ;
395
405
balancerMonolithLinks
396
406
. join (
397
407
create =>
0 commit comments