Skip to content

Commit

Permalink
[lib] refactor logout action in UserStore to ops
Browse files Browse the repository at this point in the history
Summary:
Convert logic for ops approach.

Depends on D9801

Test Plan: Logout

Reviewers: tomek

Reviewed By: tomek

Subscribers: ashoat, wyilio

Differential Revision: https://phab.comm.dev/D9802
  • Loading branch information
xsanm committed Nov 16, 2023
1 parent b61ead9 commit e24fa20
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/reducers/user-reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,16 @@ function reduceUserInfos(
(action.type === setNewSessionActionType &&
action.payload.sessionChange.cookieInvalidated)
) {
const processedUserInfos: UserInfos = processUserStoreOps(state.userInfos, [
{ type: 'remove_all_users' },
]);
assertUserStoresAreEqual(
processedUserInfos,
{},
action.type,
onStateDifference,
);

if (Object.keys(state.userInfos).length === 0) {
return [state, []];
}
Expand Down

0 comments on commit e24fa20

Please sign in to comment.