From b011a4413aa8f614d63ab50581c39024042a6b9a Mon Sep 17 00:00:00 2001 From: sup39 Date: Sat, 11 May 2024 18:50:46 +0800 Subject: [PATCH] fix: await mx.sendMessage() --- src/app/organisms/room/RoomInput.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/organisms/room/RoomInput.tsx b/src/app/organisms/room/RoomInput.tsx index e6c4fb7..cd10cfd 100644 --- a/src/app/organisms/room/RoomInput.tsx +++ b/src/app/organisms/room/RoomInput.tsx @@ -232,10 +232,12 @@ export const RoomInput = forwardRef( }); handleCancelUpload(uploads); const contents = fulfilledPromiseSettledResult(await Promise.allSettled(contentsPromises)); - contents.forEach((content) => mx.sendMessage(roomId, content)); + for (const content of contents) { + await mx.sendMessage(roomId, content); + } }; - const submit = useCallback(() => { + const submit = useCallback(async () => { uploadBoardHandlers.current?.handleSend(); const commandName = getBeginCommand(editor); @@ -304,7 +306,7 @@ export const RoomInput = forwardRef( }, }; } - mx.sendMessage(roomId, content); + await mx.sendMessage(roomId, content); resetEditor(editor); resetEditorHistory(editor); setReplyDraft();