@@ -2,6 +2,9 @@ import { Member, TEAM_SCOPE } from '.'
2
2
import { TeamLink , TeamState } from './types'
3
3
4
4
/**
5
+ * This function is used as an alternative reducer for invalid links; the normal reducer just
6
+ * returns the result of this function.
7
+ *
5
8
* Invalid links are actions that were flagged to be discarded by the MembershipResolver when
6
9
* dealing with conflicting concurrent actions.
7
10
*
@@ -10,8 +13,8 @@ import { TeamLink, TeamState } from './types'
10
13
* admitted, Charlie does stuff, etc.)
11
14
*
12
15
* 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 .
15
18
*/
16
19
export const invalidLinkReducer = ( state : TeamState , link : TeamLink ) : TeamState => {
17
20
switch ( link . body . type ) {
@@ -31,9 +34,10 @@ export const invalidLinkReducer = (state: TeamState, link: TeamLink): TeamState
31
34
[ userName ] : [ ...scopesToRotate , TEAM_SCOPE ] ,
32
35
}
33
36
34
- // Note that we don't need to alter the list of members, because they're never added
35
37
return {
36
38
...state ,
39
+ // Note that we don't need to alter the list of members, because this member is never added
40
+
37
41
removedMembers,
38
42
pendingKeyRotations,
39
43
}
0 commit comments