From 07decc10e243c3f13cc6261393b36f4f6bc65b3c Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Fri, 10 Apr 2026 16:33:53 -0400 Subject: [PATCH] potential loading time optimization --- lib/controllers/message_controller.dart | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/controllers/message_controller.dart b/lib/controllers/message_controller.dart index 79bc77ec..51f94feb 100644 --- a/lib/controllers/message_controller.dart +++ b/lib/controllers/message_controller.dart @@ -68,15 +68,17 @@ class MessageController extends AsyncNotifier { final replyId = config.event.content["m.relates_to"]?["m.in_reply_to"]?["event_id"]; - final reactionEvents = await ref - .watch(ClientController.provider.notifier) - .getRelatedEvents( - GetRelatedEventsRequest( - roomId: config.room.metadata!.id, - eventId: config.event.eventId, - relationType: "m.annotation", - ), - ); + final reactionEvents = event.reactions.isEmpty + ? null + : await ref + .watch(ClientController.provider.notifier) + .getRelatedEvents( + GetRelatedEventsRequest( + roomId: config.room.metadata!.id, + eventId: config.event.eventId, + relationType: "m.annotation", + ), + ); final reactions = reactionEvents ?.where((event) => event.redactedBy == null)