Remove "same array" check now that USER_STATE_POPULATE only runs when there is new data.

This commit is contained in:
infinite-persistence 2021-11-15 12:58:17 +08:00 committed by infinite-persistence
parent 38c13cf5ef
commit 70d18eba59
2 changed files with 1 additions and 17 deletions

View file

@ -26,14 +26,6 @@ export default handleActions(
[ACTIONS.USER_STATE_POPULATE]: (state: BlocklistState, action: { data: { blocked: ?Array<string> } }) => {
const { blocked } = action.data;
const sanitizedBlocked = blocked && blocked.filter((e) => typeof e === 'string');
const next = sanitizedBlocked;
const prev = state.blockedChannels;
if (next && prev && prev.length === next.length && prev.every((value, index) => value === next[index])) {
return state;
}
return {
...state,
blockedChannels: sanitizedBlocked || state.blockedChannels,

View file

@ -65,15 +65,7 @@ export default handleActions(
[ACTIONS.USER_STATE_POPULATE]: (state: TagState, action: { data: { tags: ?Array<string> } }) => {
const { tags } = action.data;
if (Array.isArray(tags)) {
const next = tags && tags.filter((tag) => typeof tag === 'string');
const prev = state.followedTags;
if (next && prev && prev.length === next.length && prev.every((value, index) => value === next[index])) {
// No changes
return state;
}
// New state
const next = tags.filter((tag) => typeof tag === 'string');
return {
...state,
followedTags: next || [],