[CB] put new user to top after creation #3903
Conversation
| return b.createdAt - a.createdAt; | ||
| } | ||
|
|
||
| return 0; |
There was a problem hiding this comment.
return compareUsers(a,b)? And then you dont need to sort twice in users table
There was a problem hiding this comment.
The sort function helper is called sortByNewUsers. Therefore, it's supposed to adhere to the principle of "single responsibility". If neither user is new, we should do nothing in the context of sorting in order to keep predictable behavior. If we want to, we can always combine these two sorts: sortByNewUsers and sortUsersById, which we actually do
There was a problem hiding this comment.
I believe responsibility here is to sort users. How we do that does not really matter. And we use both functions anyway only for sorting users, so why not to combine them in a single compareUsers function?
closes https://github.com/dbeaver/pro/issues/7506