Browse Source

Merge pull request #25 from provectus/fix-consumer-groups-retaining-cluster-on-cluster-switch

fix-consumer-groups-retaining-cluster-on-cluster-switch
Azat Gataullin 5 years ago
parent
commit
9ede80762e

+ 5 - 2
kafka-ui-react-app/src/redux/reducers/consumerGroups/selectors.ts

@@ -7,6 +7,7 @@ import { ConsumerGroupID, ConsumerGroupsState } from '../../interfaces/consumerG
 const consumerGroupsState = ({ consumerGroups }: RootState): ConsumerGroupsState => consumerGroups;
 const consumerGroupsState = ({ consumerGroups }: RootState): ConsumerGroupsState => consumerGroups;
 
 
 const getConsumerGroupsMap = (state: RootState) => consumerGroupsState(state).byID;
 const getConsumerGroupsMap = (state: RootState) => consumerGroupsState(state).byID;
+const getConsumerGroupsIDsList = (state: RootState) => consumerGroupsState(state).allIDs;
 
 
 const getConsumerGroupsListFetchingStatus = createFetchingSelector('GET_CONSUMER_GROUPS');
 const getConsumerGroupsListFetchingStatus = createFetchingSelector('GET_CONSUMER_GROUPS');
 const getConsumerGroupDetailsFetchingStatus = createFetchingSelector('GET_CONSUMER_GROUP_DETAILS');
 const getConsumerGroupDetailsFetchingStatus = createFetchingSelector('GET_CONSUMER_GROUP_DETAILS');
@@ -24,11 +25,13 @@ export const getIsConsumerGroupDetailsFetched = createSelector(
 export const getConsumerGroupsList = createSelector(
 export const getConsumerGroupsList = createSelector(
   getIsConsumerGroupsListFetched,
   getIsConsumerGroupsListFetched,
   getConsumerGroupsMap,
   getConsumerGroupsMap,
-  (isFetched, byID) => {
+  getConsumerGroupsIDsList,
+  (isFetched, byID, ids) => {
     if (!isFetched) {
     if (!isFetched) {
       return [];
       return [];
     }
     }
-    return Object.keys(byID).map( (key) => byID[key]);
+
+    return ids.map(key => byID[key]);
   },
   },
 );
 );