@@ -17,7 +17,7 @@ import { logError } from '@codesandbox/common/lib/utils/analytics';
17
17
export const onJoin : Operator < LiveMessage < {
18
18
status : 'connected' ;
19
19
live_user_id : string ;
20
- } > > = mutate ( ( { effects, state } , { data } ) => {
20
+ } > > = mutate ( ( { effects, actions , state } , { data } ) => {
21
21
state . live . liveUserId = data . live_user_id ;
22
22
23
23
// Show message to confirm that you've joined a live session if you're not the owner
@@ -26,9 +26,15 @@ export const onJoin: Operator<LiveMessage<{
26
26
}
27
27
28
28
if ( state . live . reconnecting ) {
29
+ // We reconnected!
29
30
effects . live . getAllClients ( ) . forEach ( client => {
30
31
client . serverReconnect ( ) ;
31
32
} ) ;
33
+
34
+ if ( state . live . roomInfo ) {
35
+ // Clear all user selections
36
+ actions . live . internal . clearUserSelections ( null ) ;
37
+ }
32
38
}
33
39
34
40
state . live . reconnecting = false ;
@@ -129,11 +135,6 @@ export const onUserLeft: Operator<LiveMessage<{
129
135
return ;
130
136
}
131
137
132
- if ( state . live . followingUserId === data . left_user_id ) {
133
- // Unfollow user if they are the one who left
134
- actions . live . onStopFollow ( ) ;
135
- }
136
-
137
138
if ( ! state . live . notificationsHidden ) {
138
139
const { users } = state . live . roomInfo ;
139
140
const user = users ? users . find ( u => u . id === data . left_user_id ) : null ;
@@ -150,7 +151,7 @@ export const onUserLeft: Operator<LiveMessage<{
150
151
}
151
152
}
152
153
153
- actions . live . internal . clearUserSelections ( data . left_user_id ) ;
154
+ actions . live . onUserLeft ( { liveUserId : data . left_user_id } ) ;
154
155
155
156
const users = camelizeKeys ( data . users ) as LiveUser [ ] ;
156
157
0 commit comments