Skip to content

Commit 86a8ad9

Browse files
committed
compose_box [nfc]: Reorder two calls in edit-message "Save" tap handler
Making sure to capture some data that store.editMessage needs from the controller before that data is destroyed, in composeBoxState.endEditInteraction, which disposes the controller. Motivation: soon we'd like `store.editMessage` to return a Future, which we'd like to await and add some error feedback, just like we have in the send-message UX.
1 parent 6b7ba52 commit 86a8ad9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/widgets/compose_box.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,11 +1815,13 @@ class _EditMessageBanner extends _Banner {
18151815
return;
18161816
}
18171817

1818+
final messageId = controller.messageId;
1819+
final newContent = controller.content.textNormalized;
1820+
composeBoxState.endEditInteraction();
18181821
store.editMessage(
1819-
messageId: controller.messageId,
1822+
messageId: messageId,
18201823
originalRawContent: originalRawContent,
1821-
newContent: controller.content.textNormalized);
1822-
composeBoxState.endEditInteraction();
1824+
newContent: newContent);
18231825
}
18241826

18251827
@override

0 commit comments

Comments
 (0)