fix: await mx.sendMessage()

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

View file

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