11import type { MetaClusterVersion } from '../../types/api/meta' ;
22
3+ import { COLORS , DEFAULT_COLOR , getMinorVersionColorVariant , hashCode } from './getVersionsColors' ;
4+ import { getMinorVersion } from './parseVersion' ;
35import { sortVersions } from './sortVersions' ;
46import type {
57 ColorIndexToVersionsMap ,
@@ -8,8 +10,6 @@ import type {
810 VersionsDataMap ,
911} from './types' ;
1012
11- import { COLORS , DEFAULT_COLOR , getMinorVersion , getMinorVersionColorVariant , hashCode } from '.' ;
12-
1313const UNDEFINED_COLOR_INDEX = '__no_color__' ;
1414
1515export const getVersionMap = (
@@ -75,23 +75,24 @@ export const prepareClusterVersions = (
7575 filteredVersions . forEach ( ( item ) => {
7676 if ( result [ item . version ] ) {
7777 // Sum count for versions of different nodes types
78+ // Do not recalculate version data
7879 const currentCount = result [ item . version ] . count || 0 ;
7980 const itemCount = item . count || 0 ;
8081
8182 result [ item . version ] . count = currentCount + itemCount ;
83+ } else {
84+ const minorVersion = getMinorVersion ( item . version ) ;
85+ const data = versionsDataMap . get ( minorVersion ) ;
86+
87+ result [ item . version ] = {
88+ version : item . version ,
89+ minorVersion,
90+ color : data ?. color ,
91+ majorIndex : data ?. majorIndex ,
92+ minorIndex : data ?. minorIndex ,
93+ count : item . count || 0 ,
94+ } ;
8295 }
83-
84- const minorVersion = getMinorVersion ( item . version ) ;
85- const data = versionsDataMap . get ( minorVersion ) ;
86-
87- result [ item . version ] = {
88- version : item . version ,
89- minorVersion,
90- color : data ?. color ,
91- majorIndex : data ?. majorIndex ,
92- minorIndex : data ?. minorIndex ,
93- count : item . count || 0 ,
94- } ;
9596 } ) ;
9697
9798 return sortVersions ( Object . values ( result ) ) ;
0 commit comments