From b195fc6ee065e7ff4ae481a5e2500651b7d09b38 Mon Sep 17 00:00:00 2001 From: Carl <4ddaeec1f70e26699465b4f4d4a55a825abb6045d769a21d44551b15c1e81f93@buzz.block.builderlab.xyz> Date: Fri, 28 Aug 2026 11:40:27 -0700 Subject: [PATCH] Keep channel provider within size limit Signed-off-by: Carl <4ddaeec1f70e26699465b4f4d4a55a825abb6045d769a21d44551b15c1e81f93@buzz.block.builderlab.xyz> --- mobile/lib/features/channels/channels_provider.dart | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mobile/lib/features/channels/channels_provider.dart b/mobile/lib/features/channels/channels_provider.dart index b148dc2998..c3f1090927 100644 --- a/mobile/lib/features/channels/channels_provider.dart +++ b/mobile/lib/features/channels/channels_provider.dart @@ -378,10 +378,8 @@ class ChannelsNotifier extends AsyncNotifier> { // Scoped narrowly to the archived flip — broader metadata staleness // (renames, topic changes, etc.) is a separate, pre-existing concern that // already affects this provider for other reasons. - // Re-check before the first write that other providers can observe. Every // await above is fenced, but the switch can also land in the synchronous - // gap, so the guard sits immediately before the write rather than only - // after the await. + // gap, so the guard sits immediately before the write. fence.ensureCurrent(); final prevById = { @@ -390,7 +388,7 @@ class ChannelsNotifier extends AsyncNotifier> { for (var i = 0; i < channels.length; i++) { final previous = prevById[channels[i].id]?.lastMessageAt; if (previous != null && - (channels[i].lastMessageAt?.isBefore(previous) ?? true)) { + previous.isAfter(channels[i].lastMessageAt ?? DateTime(0))) { channels[i] = channels[i].copyWith(lastMessageAt: previous); } }