From d7f49568a7dd5d7ccff8986986668458b2712464 Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Wed, 29 Jul 2026 12:11:57 -0400 Subject: [PATCH] move attachment sending check to be earlier fixes sending with keyboard before attachment uploaded --- lib/controllers/room_chat.dart | 8 +++----- lib/widgets/composer/composer.dart | 5 ++++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/controllers/room_chat.dart b/lib/controllers/room_chat.dart index 558817c..3e531bb 100644 --- a/lib/controllers/room_chat.dart +++ b/lib/controllers/room_chat.dart @@ -125,11 +125,9 @@ class RoomChatController extends AsyncNotifier?> { if (relationType == .edit) { baseContent = relation?.content; } else { - final attachment = ref.watch(AttachmentController.provider(roomId)); - if (attachment != null && attachment.$2 == null) return; - - baseContent = attachment?.$2; - ref.invalidate(AttachmentController.provider(roomId)); + final provider = AttachmentController.provider(roomId); + baseContent = ref.watch(provider)?.$2; + ref.invalidate(provider); } var taggedMessage = text; diff --git a/lib/widgets/composer/composer.dart b/lib/widgets/composer/composer.dart index c63d939..ca3de8a 100644 --- a/lib/widgets/composer/composer.dart +++ b/lib/widgets/composer/composer.dart @@ -59,7 +59,10 @@ class Composer extends HookConsumerWidget { final attachment = ref.watch(AttachmentController.provider(roomId)); void send() { - if (controller.value.text.isEmpty && attachment == null) return; + if (controller.value.text.isEmpty && attachment == null || + attachment != null && attachment.$2 == null) { + return; + } onSend( controller.value.formattedText, shouldMention: shouldMention.value,