Fix sorting users if there are users without nicknames or IDs

This commit is contained in:
Angelina Filippova 2020-05-18 20:10:33 +03:00
parent 7b7a05170a
commit 1c2782a522

View file

@ -51,9 +51,11 @@ const users = {
return return
} }
state.fetchedUsers = [...usersWithoutSwapped, ...users].sort((a, b) => const updatedUsers = [...usersWithoutSwapped, ...users]
a.nickname.localeCompare(b.nickname) state.fetchedUsers = updatedUsers
) .filter(user => user.nickname && user.id)
.sort((a, b) => a.nickname.localeCompare(b.nickname))
.concat(updatedUsers.filter(user => !user.nickname || !user.id))
}, },
SET_COUNT: (state, count) => { SET_COUNT: (state, count) => {
state.totalUsersCount = count state.totalUsersCount = count