Merge pull request #676 from zjs81/fix/list-sorting-and-performance
Fix list ordering and long-list scrolling
This commit is contained in:
35 files changed
+1357
-43
No files matched your search
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user