File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
redisinsight/ui/src/components/pub-sub-config Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -99,11 +99,15 @@ const PubSubConfig = ({ retryDelay = 5000 } : IProps) => {
99
99
const onChannelsSubscribe = ( ) => {
100
100
dispatch ( setLoading ( false ) )
101
101
dispatch ( setIsPubSubSubscribed ( ) )
102
-
103
102
subscriptions . forEach ( ( { channel, type } : PubSubSubscription ) => {
104
- socketRef . current ?. on ( `${ type } :${ channel } ` , ( data ) => {
105
- dispatch ( concatPubSubMessages ( data ) )
106
- } )
103
+ const subscription = `${ type } :${ channel } `
104
+ const isListenerExist = ! ! socketRef . current ?. listeners ( subscription ) . length
105
+
106
+ if ( ! isListenerExist ) {
107
+ socketRef . current ?. on ( subscription , ( data ) => {
108
+ dispatch ( concatPubSubMessages ( data ) )
109
+ } )
110
+ }
107
111
} )
108
112
}
109
113
You can’t perform that action at this time.
0 commit comments