try to fix disposed errors when ending poll

This commit is contained in:
Henry Hiles 2026-11-03 14:26:53 -05:00
commit 2580cc8c1c
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -466,6 +466,8 @@ class RoomChatController(final ChatParams info)
EventType type,
Content content,
) async {
// The end event lands in the timeline and rebuilds this, so no ref after awaiting
final rooms = ref.read(RoomsController.provider.notifier);
final event = await ref
.read(ClientController.provider.notifier)
.sendEvent(
@ -481,9 +483,7 @@ class RoomChatController(final ChatParams info)
if (event.sendFailed) throw Exception(event.sendError);
await ref
.read(RoomsController.provider.notifier)
.awaitEvent(info.roomId, event.eventId);
await rooms.awaitEvent(info.roomId, event.eventId);
}
/// An empty [answers] removes the vote.