fix: multiple tabs display duplicate online users

This commit is contained in:
molvqingtai 2024-10-02 23:40:12 +08:00
parent 65bf9b2419
commit 8b843ac45c

View file

@ -237,9 +237,9 @@ const RoomDomain = Remesh.domain({
impl: ({ get }, action: { type: 'create' | 'delete'; user: RoomUser }) => {
const userList = get(UserListState())
if (action.type === 'create') {
return [UserListState().new(upsert(userList, action.user, 'peerId'))]
return [UserListState().new(upsert(userList, action.user, 'userId'))]
} else {
return [UserListState().new(userList.filter(({ peerId }) => peerId !== action.user.peerId))]
return [UserListState().new(userList.filter(({ userId }) => userId !== action.user.userId))]
}
}
})