Skip to content

Commit 90c1f09

Browse files
committed
Fix showing message of user left
1 parent 74fbb72 commit 90c1f09

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

packages/app/src/app/overmind/namespaces/live/liveMessageOperators.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const onUserEntered: Operator<LiveMessage<{
8383
});
8484

8585
export const onUserLeft: Operator<LiveMessage<{
86-
users: any[];
86+
users: LiveUser[];
8787
left_user_id: string;
8888
editor_ids: string[];
8989
owner_ids: string[];
@@ -92,7 +92,7 @@ export const onUserLeft: Operator<LiveMessage<{
9292
const { users } = state.live.roomInfo;
9393
const user = users ? users.find(u => u.id === data.left_user_id) : null;
9494

95-
if (user.id !== state.live.liveUserId) {
95+
if (user && user.id !== state.live.liveUserId) {
9696
effects.notificationToast.add({
9797
message: user
9898
? `${user.username} left the live session.`
@@ -104,11 +104,9 @@ export const onUserLeft: Operator<LiveMessage<{
104104

105105
actions.live.internal.clearUserSelections(data.left_user_id);
106106

107-
const users = camelizeKeys(data.users);
107+
const users = camelizeKeys(data.users) as LiveUser[];
108108

109-
// TODO: Same here, not an array?
110-
// Check running code
111-
state.live.roomInfo.users = users as any;
109+
state.live.roomInfo.users = users;
112110
state.live.roomInfo.ownerIds = data.owner_ids;
113111
state.live.roomInfo.editorIds = data.editor_ids;
114112
});

0 commit comments

Comments
 (0)