From 6c0d7b6feda8786dccdf2860297954dd0213f389 Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Sat, 26 Sep 2026 12:41:00 -0400 Subject: [PATCH] slight cleanups --- lib/controllers/room_chat.dart | 10 +++++++++- lib/helpers/hooks/chat_scroll.dart | 8 ++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/controllers/room_chat.dart b/lib/controllers/room_chat.dart index 23e4afd..91b137a 100644 --- a/lib/controllers/room_chat.dart +++ b/lib/controllers/room_chat.dart @@ -90,8 +90,16 @@ class RoomChatController(final (String roomId, String? contextualEvent) info) ); Future paginate(Direction direction) async { - if (state.isLoading || state.value?.hasMoreBackward == false) return; + if (state.isLoading) return; + final chat = await future; + + if (direction == .forward + ? chat?.hasMoreForward == false + : chat?.hasMoreBackward == false) { + return; + } + state = .loading(); final client = ref.read(ClientController.provider.notifier); diff --git a/lib/helpers/hooks/chat_scroll.dart b/lib/helpers/hooks/chat_scroll.dart index 9275097..3166087 100644 --- a/lib/helpers/hooks/chat_scroll.dart +++ b/lib/helpers/hooks/chat_scroll.dart @@ -30,12 +30,8 @@ final class ChatScroll({ final anchorItemKey = useMemoized(GlobalKey.new, [anchorId.value]); - final historyListController = useMemoized(ListController.new, [ - anchorId.value, - ]); - final liveListController = useMemoized(ListController.new, [ - anchorId.value, - ]); + final historyListController = useMemoized(ListController.new); + final liveListController = useMemoized(ListController.new); final scrollController = useScrollController(); final centerKey = useMemoized(GlobalKey.new);