Fix Selectors to not give error if not fetched yet (#2075)

This commit is contained in:
Mgrdich 2022-05-31 17:17:40 +04:00 committed by GitHub
parent 89c409a5d6
commit c42858e722
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -138,7 +138,7 @@ const getTopicName = (_: RootState, topicName: TopicName) => topicName;
export const getTopicByName = createSelector( export const getTopicByName = createSelector(
getTopicMap, getTopicMap,
getTopicName, getTopicName,
(topics, topicName) => topics[topicName] (topics, topicName) => topics[topicName] || {}
); );
export const getPartitionsByTopicName = createSelector( export const getPartitionsByTopicName = createSelector(
@ -201,9 +201,8 @@ export const getIsTopicInternal = createSelector(
); );
export const getTopicConsumerGroups = createSelector( export const getTopicConsumerGroups = createSelector(
getTopicMap, getTopicByName,
getTopicName, ({ consumerGroups }) => consumerGroups || []
(topics, topicName) => topics[topicName].consumerGroups || []
); );
export const getMessageSchemaByTopicName = createSelector( export const getMessageSchemaByTopicName = createSelector(