File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
redisinsight/ui/src/components/live-time-recommendations Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,8 @@ const LiveTimeRecommendations = () => {
75
75
// To prevent duplication emit for FlyOut close event
76
76
// https://github.com/elastic/eui/issues/3437
77
77
const isCloseEventSent = useRef < boolean > ( false )
78
+ // Flyout onClose did not updated between rerenders
79
+ const recommendationsState = useRef < IRecommendation [ ] > ( [ ] )
78
80
79
81
const dispatch = useDispatch ( )
80
82
const history = useHistory ( )
@@ -108,6 +110,10 @@ const LiveTimeRecommendations = () => {
108
110
}
109
111
} , [ isContentVisible ] )
110
112
113
+ useEffect ( ( ) => {
114
+ recommendationsState . current = recommendations
115
+ } , [ recommendations ] )
116
+
111
117
const toggleContent = ( ) => {
112
118
dispatch ( setIsContentVisible ( ! isContentVisible ) )
113
119
}
@@ -145,7 +151,7 @@ const LiveTimeRecommendations = () => {
145
151
dispatch ( setIsContentVisible ( false ) )
146
152
sendEventTelemetry ( {
147
153
event : TelemetryEvent . INSIGHTS_PANEL_CLOSED ,
148
- eventData : getTelemetryData ( recommendations ) ,
154
+ eventData : getTelemetryData ( recommendationsState . current ) ,
149
155
} )
150
156
isCloseEventSent . current = true
151
157
}
You can’t perform that action at this time.
0 commit comments