Merge pull request #676 from zjs81/fix/list-sorting-and-performance

Fix list ordering and long-list scrolling
This commit is contained in:
zjs81 authored and GitHub committed 2026-11-20 21:21:07 -07:00
commit ae967ec21f
35 files changed
+1357 -43

No files matched your search

+2 -1
View File
@@ -783,13 +783,14 @@ class _ChannelsScreenState extends State<ChannelsScreen> {
break;
case ChannelSortOption.latestMessages:
// Filtered messages don't bump a channel, matching the preview.
// Ordered by local arrival time: sender clocks can be far off.
// Looked up once per channel: the lookup can scan back through
// filtered messages, and the comparator runs O(n log n) times.
final epoch = DateTime(1970);
final latest = <Channel, DateTime>{
for (final channel in filtered)
channel:
connector.latestVisibleChannelMessage(channel)?.timestamp ??
connector.latestVisibleChannelMessage(channel)?.receivedAt ??
epoch,
};
filtered.sort((a, b) {