diff --git a/lib/reducers/user-reducer.js b/lib/reducers/user-reducer.js --- a/lib/reducers/user-reducer.js +++ b/lib/reducers/user-reducer.js @@ -19,6 +19,7 @@ } from '../actions/user-actions.js'; import { convertUserInfosToReplaceUserOps, + type UserStoreOperation, userStoreOpsHandlers, } from '../ops/user-store-ops.js'; import { stateSyncSpecs } from '../shared/state-sync/state-sync-specs.js'; @@ -271,18 +272,35 @@ return [state, []]; } + const userStoreOps: UserStoreOperation[] = []; const newUserInfos = { ...state.userInfos }; if (userInfos) { for (const userInfo of userInfos) { newUserInfos[userInfo.id] = userInfo; + userStoreOps.push({ type: 'replace_user', payload: { ...userInfo } }); } } if (deleteUserInfoIDs) { for (const deleteUserInfoID of deleteUserInfoIDs) { delete newUserInfos[deleteUserInfoID]; } + userStoreOps.push({ + type: 'remove_users', + payload: { ids: deleteUserInfoIDs }, + }); } + const processedUserInfos: UserInfos = processUserStoreOps( + state.userInfos, + userStoreOps, + ); + assertUserStoresAreEqual( + processedUserInfos, + newUserInfos, + action.type, + onStateDifference, + ); + const newInconsistencies = stateSyncSpecs.users.findStoreInconsistencies( action, state.userInfos,