fix room watch

This commit is contained in:
Henry Hiles 2026-05-17 21:42:14 -04:00
commit 8d9645b460
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -51,11 +51,13 @@ class RoomChatController extends AsyncNotifier<IList<Event>> {
const ISet.empty(), const ISet.empty(),
); );
final room = ref.watch(RoomsController.provider)[roomId]; final room = ref.watch(
RoomsController.provider.select((rooms) => rooms[roomId]),
);
if (room == null) return const IList.empty(); if (room == null) return const IList.empty();
// While there are under 20 messages, try up to load more messages until there's no more or we have 20 messages. // While there are under 30 messages, try up to load more messages until there's no more or we have 20 messages.
if (room.hasMore && room.events.length < 20) { if (room.hasMore && room.events.length < 30) {
loadOlder(); loadOlder();
} }