fix: Currently viewing users should be ordered to top

This commit is contained in:
Tom Moor
2021-05-05 21:11:09 -07:00
parent 4f4067c449
commit 71de0c7e5f
2 changed files with 23 additions and 10 deletions

View File

@ -35,8 +35,9 @@ function DocumentViews({ document, isOpen }: Props) {
// ensure currently present via websocket are always ordered first
const documentViews = views.inDocument(document.id);
const sortedViews = sortBy(documentViews, (view) =>
presentIds.includes(view.user.id)
const sortedViews = sortBy(
documentViews,
(view) => !presentIds.includes(view.user.id)
);
const users = React.useMemo(() => sortedViews.map((v) => v.user), [
@ -70,6 +71,7 @@ function DocumentViews({ document, isOpen }: Props) {
subtitle={subtitle}
image={<Avatar key={item.id} src={item.avatarUrl} size={32} />}
border={false}
small
/>
);
}}