Skip to content

Commit 1e5ea81

Browse files
committed
auth/team/invalidLinkReducer.ts:
1 parent 9c917aa commit 1e5ea81

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/auth/src/team/invalidLinkReducer.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { Member, TEAM_SCOPE } from '.'
22
import { TeamLink, TeamState } from './types'
33

44
/**
5+
* This function is used as an alternative reducer for invalid links; the normal reducer just
6+
* returns the result of this function.
7+
*
58
* Invalid links are actions that were flagged to be discarded by the MembershipResolver when
69
* dealing with conflicting concurrent actions.
710
*
@@ -10,8 +13,8 @@ import { TeamLink, TeamState } from './types'
1013
* admitted, Charlie does stuff, etc.)
1114
*
1215
* Normally we just ignore these links and they don't affect state at all. However, there are some
13-
* situations where we need to pay attention. In the above example, we need to act as if
14-
* Charlie was removed from the team.
16+
* situations where we need to pay attention. In the above example, we need to act as if Charlie was
17+
* removed from the team, and do some cleanup.
1518
*/
1619
export const invalidLinkReducer = (state: TeamState, link: TeamLink): TeamState => {
1720
switch (link.body.type) {
@@ -31,9 +34,10 @@ export const invalidLinkReducer = (state: TeamState, link: TeamLink): TeamState
3134
[userName]: [...scopesToRotate, TEAM_SCOPE],
3235
}
3336

34-
// Note that we don't need to alter the list of members, because they're never added
3537
return {
3638
...state,
39+
// Note that we don't need to alter the list of members, because this member is never added
40+
3741
removedMembers,
3842
pendingKeyRotations,
3943
}

0 commit comments

Comments
 (0)