From bd1ddea86228ed2cebdbac451e938a7409af2281 Mon Sep 17 00:00:00 2001 From: Suman Biswas Date: Sun, 8 Nov 2026 00:00:55 +0530 Subject: [PATCH] fix(mob): stop retrying older messages in a loop after a failure A failed page load rebuilt the list, and the scroll listener asked for the same page again straight away, about 10 requests a second for as long as the chat stayed open. After a failure, stop paging until the chat is reopened. Closes #174 --- mobile/lib/controllers/chat/active_chat_controller.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mobile/lib/controllers/chat/active_chat_controller.dart b/mobile/lib/controllers/chat/active_chat_controller.dart index a2b47c8..ed554bb 100644 --- a/mobile/lib/controllers/chat/active_chat_controller.dart +++ b/mobile/lib/controllers/chat/active_chat_controller.dart @@ -150,6 +150,9 @@ class ActiveChatController extends ChangeNotifier { await _cache(targetUid, older); } catch (e) { debugPrint("Failed to load older messages: $e"); + // Stop paging until the chat is reopened; otherwise the rebuild below + // re-triggers this from the scroll listener in a tight retry loop. + hasMoreMessages = false; } finally { isLoadingMore = false; notifyListeners();