@@ -8,6 +8,7 @@ import { QueryContext } from '../context/QueryContext';
8
8
import { HealthContext } from '../context/HealthContext' ;
9
9
import { EventContext } from '../context/EventContext' ;
10
10
import AvQueuePlayNext from 'material-ui/svg-icons/av/queue-play-next' ;
11
+ import { useIsMount } from '../context/helpers' ;
11
12
12
13
const TableTransfer = ( { leftColumns, rightColumns, ...restProps } ) => (
13
14
< Transfer { ...restProps } >
@@ -79,6 +80,7 @@ const TransferColumns = React.memo(() => {
79
80
80
81
const eventDataList = eventData . eventDataList ;
81
82
const healthDataList = healthData . healthDataList ;
83
+ const isMount = useIsMount ( ) ;
82
84
83
85
useEffect ( ( ) => {
84
86
if ( healthDataList && healthDataList . length > 0 ) {
@@ -106,10 +108,19 @@ const TransferColumns = React.memo(() => {
106
108
107
109
} , [ eventMetricsReady ] ) ;
108
110
111
+
112
+
109
113
useEffect ( ( ) => {
110
- console . log ( "current service:" , service )
114
+ // if(isMount){//skip first render
115
+ // return;
116
+ // }
117
+ console . log ( "current service:" , service ) ;
118
+ console . log ( "healthData in else:" , healthDataList . length ) ;
119
+ console . log ( "eventData in else:" , eventDataList . length ) ;
120
+ console . log ( "healthMetricsReady:" , healthMetricsReady ) ;
121
+ console . log ( "eventMetricsReady:" , eventMetricsReady ) ;
111
122
if ( service === '' ) {
112
- //pass
123
+ return ;
113
124
}
114
125
else if ( service === 'kafkametrics' ) {
115
126
// console.log("set event metrics:", JSON.stringify(eventMetrics));
@@ -122,20 +133,22 @@ const TransferColumns = React.memo(() => {
122
133
}
123
134
124
135
}
125
- else if ( ! service . includes ( 'kafkametrics' ) ) {
126
- console . log ( "healthDataList:" , JSON . stringify ( healthDataList ) ) ;
136
+ else if ( ! service . includes ( 'kafkametrics' ) ) { //all health data
137
+ console . log ( "healthDataList in elseif :" , JSON . stringify ( healthDataList ) ) ;
127
138
// console.log("set health metrics:", JSON.stringify(healthMetrics));
128
139
if ( healthDataList && healthDataList . length > 0 ) {
129
140
setMetricsPool ( getMetrics ( 'health' , healthDataList ) ) ;
130
141
}
131
- else {
142
+ else if ( healthMetricsReady ) {
132
143
setMetricsPool ( healthMetrics ) ;
133
144
}
145
+ else {
146
+ return ;
147
+ }
134
148
135
149
}
136
150
else {
137
- console . log ( "healthData in else:" , healthDataList . length ) ;
138
- console . log ( "eventData in else:" , eventDataList . length ) ;
151
+
139
152
if ( healthDataList && healthDataList . length > 0 && eventDataList && eventDataList . length > 0 ) {
140
153
console . log ( "eventDataList:" , eventDataList . length ) ;
141
154
console . log ( "healthDataList" , healthDataList . length ) ;
@@ -145,6 +158,7 @@ const TransferColumns = React.memo(() => {
145
158
console . log ( "set concat metrics:" , JSON . stringify ( eventMetrics . concat ( healthMetrics ) ) ) ;
146
159
setMetricsPool ( eventMetrics . concat ( healthMetrics ) ) ;
147
160
}
161
+
148
162
console . log ( "here" ) ;
149
163
150
164
0 commit comments