Skip to content

Commit

Permalink
!fixup recency doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywan committed Jul 3, 2024
1 parent cb2173f commit f633fb0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions crates/matrix-sdk-ui/src/room_list_service/sorters/recency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ where
//
// The way our `Room` types are implemented makes it so they are sharing the
// same data, because they are all built from the same store. They can be seen
// as shallow clones of each others. In practise it's really great: a `Room` can
// as shallow clones of each others. In practice it's really great: a `Room` can
// never be outdated. However, for the case of sorting rooms, it breaks the
// search algorithm. `left` and `right` will have the exact same `LatestEvent`,
// so `left` and `right` will always be `Ordering::Equal`. This is wrong: if
Expand All @@ -46,9 +46,8 @@ where
// `Equal`, the position may not change. It actually depends of the search
// algorithm used by [`eyeball_im_util::SortBy`].
//
// Since this sorter is sorting rooms from the most recent latest event to the
// oldest, we should return `Ordering::Greatest`: the room is greatest to its
// previous version.
// Since this room received an update, it is more recent than the previous one
// we matched against, so return `Ordering::Greater`.
return Ordering::Greater;
}

Expand Down

0 comments on commit f633fb0

Please sign in to comment.