patch null blocked error

This commit is contained in:
jessop 2020-08-24 13:56:26 -04:00 committed by Sean Yesmunt
parent 353c57a568
commit c78e1e2970
3 changed files with 6 additions and 2 deletions

View file

@ -1282,5 +1282,6 @@
"Not Now": "Not Now",
"Enter your phone number and we will send you a verification code. We will not share your phone number with third parties.": "Enter your phone number and we will send you a verification code. We will not share your phone number with third parties.",
"Number": "Number",
"You can have more than one or remove this later.": "You can have more than one or remove this later.",
"--end--": "--end--"
}

View file

@ -29,9 +29,10 @@ export default handleActions(
action: { data: { blocked: ?Array<string> } }
) => {
const { blocked } = action.data;
const sanitizedBlocked = blocked && blocked.filter(e => typeof e === 'string');
return {
...state,
blockedChannels: blocked && blocked.length ? blocked : state.blockedChannels,
blockedChannels: sanitizedBlocked && sanitizedBlocked.length ? sanitizedBlocked : state.blockedChannels,
};
},
},

View file

@ -3,7 +3,9 @@ import { createSelector } from 'reselect';
const selectState = (state: { blocked: BlocklistState }) => state.blocked || {};
export const selectBlockedChannels = createSelector(selectState, (state: BlocklistState) => state.blockedChannels);
export const selectBlockedChannels = createSelector(selectState, (state: BlocklistState) => {
return state.blockedChannels.filter(e => typeof e === 'string');
});
export const selectBlockedChannelsCount = createSelector(selectBlockedChannels, (state: Array<string>) => state.length);