fix: await mx.sendMessage()

This commit is contained in:
sup39 2024-05-11 18:50:46 +08:00
parent 027bfdadeb
commit db4ac6a2c2
Signed by: sup39
GPG key ID: 111C00916C1641E5

View file

@ -237,10 +237,12 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
});
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);
@ -309,7 +311,7 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
},
};
}
mx.sendMessage(roomId, content);
await mx.sendMessage(roomId, content);
resetEditor(editor);
resetEditorHistory(editor);
setReplyDraft(undefined);