From 2cf5b8382cb3159657318036b2eebd4475a1cb43 Mon Sep 17 00:00:00 2001 From: Evie Gauthier Date: Wed, 4 Mar 2026 19:24:01 -0500 Subject: [PATCH 1/3] fix: improve message send UX - Remove 'Sending...' text from pending messages; text is now dimmed via opacity while in-flight to reduce timeline jump - Add 'Delete' button alongside 'Retry' on failed sends, using mx.cancelPendingEvent for client-side removal - Clear the input box immediately on send rather than waiting for the network round-trip to complete --- src/app/features/room/RoomInput.tsx | 8 +++----- src/app/features/room/RoomTimeline.tsx | 11 +++++++++++ src/app/features/room/message/Message.tsx | 24 ++++++++++++++++------- 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src/app/features/room/RoomInput.tsx b/src/app/features/room/RoomInput.tsx index 3c2ca181..abd46d49 100644 --- a/src/app/features/room/RoomInput.tsx +++ b/src/app/features/room/RoomInput.tsx @@ -499,12 +499,10 @@ export const RoomInput = forwardRef( // Cancel failed — leave state intact for retry } } else { - try { - await mx.sendMessage(roomId, content as any); - } catch (error) { - log.error('failed to send message', { roomId }, error); - } resetInput(); + mx.sendMessage(roomId, content as any).catch((error: unknown) => { + log.error('failed to send message', { roomId }, error); + }); } }, [ mx, diff --git a/src/app/features/room/RoomTimeline.tsx b/src/app/features/room/RoomTimeline.tsx index c153ab52..f9a652c5 100644 --- a/src/app/features/room/RoomTimeline.tsx +++ b/src/app/features/room/RoomTimeline.tsx @@ -1197,6 +1197,14 @@ export function RoomTimeline({ [mx, room] ); + const handleDeleteFailedSend = useCallback( + (mEvent: MatrixEvent) => { + if (mEvent.getAssociatedStatus() !== EventStatus.NOT_SENT) return; + mx.cancelPendingEvent(mEvent); + }, + [mx] + ); + const handleEdit = useCallback( (editEvtId?: string) => { if (editEvtId) { @@ -1269,6 +1277,7 @@ export function RoomTimeline({ senderDisplayName={senderDisplayName} sendStatus={mEvent.getAssociatedStatus()} onResend={handleResend} + onDeleteFailedSend={handleDeleteFailedSend} onEditId={handleEdit} activeReplyId={activeReplyId} reply={ @@ -1356,6 +1365,7 @@ export function RoomTimeline({ senderDisplayName={senderDisplayName} sendStatus={mEvent.getAssociatedStatus()} onResend={handleResend} + onDeleteFailedSend={handleDeleteFailedSend} reply={ replyEventId && ( void; + onDeleteFailedSend?: (event: MatrixEvent) => void; }; function useMobileDoubleTap(callback: () => void, delay = 300) { @@ -308,6 +309,7 @@ function MessageInternal( activeReplyId, sendStatus, onResend, + onDeleteFailedSend, ...props }: MessageProps & { className?: string; children?: ReactNode }, ref: any @@ -445,6 +447,7 @@ function MessageInternal( sendStatus === EventStatus.SENDING; const isFailedSend = sendStatus === EventStatus.NOT_SENT; const canResend = isFailedSend && senderId === mx.getUserId() && !!onResend; + const canDeleteFailedSend = isFailedSend && senderId === mx.getUserId() && !!onDeleteFailedSend; const handleResendClick: MouseEventHandler = useCallback( (evt) => { @@ -455,6 +458,15 @@ function MessageInternal( [mEvent, onResend] ); + const handleDeleteFailedSendClick: MouseEventHandler = useCallback( + (evt) => { + evt.preventDefault(); + evt.stopPropagation(); + onDeleteFailedSend?.(mEvent); + }, + [mEvent, onDeleteFailedSend] + ); + const MSG_CONTENT_STYLE = { maxWidth: '100%' }; const msgContentJSX = ( @@ -484,13 +496,6 @@ function MessageInternal( {children} )} {reactions} - {isPendingSend && ( - - - Sending... - - - )} {isFailedSend && ( @@ -501,6 +506,11 @@ function MessageInternal( Retry )} + {canDeleteFailedSend && ( + + )} )} From d88682a2977285834588e923e4d038592a328734 Mon Sep 17 00:00:00 2001 From: Evie Gauthier Date: Wed, 4 Mar 2026 19:26:21 -0500 Subject: [PATCH 2/3] fix: correct pending/failed message opacity levels P500 resolves to 1.0 (fully opaque) so pending messages were not visually dimmed at all. Switch to Placeholder (0.5) for pending to match Discord's treatment, and P300 (0.75) for failed to keep it visually distinct from pending. --- src/app/features/room/message/styles.css.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/features/room/message/styles.css.ts b/src/app/features/room/message/styles.css.ts index 8b52f526..49ccfb92 100644 --- a/src/app/features/room/message/styles.css.ts +++ b/src/app/features/room/message/styles.css.ts @@ -57,11 +57,11 @@ export const ReactionsTooltipText = style({ }); export const MessagePending = style({ - opacity: config.opacity.P500, + opacity: config.opacity.Placeholder, }); export const MessageFailed = style({ - opacity: config.opacity.P400, + opacity: config.opacity.P300, }); export const SendStatusRow = style({ From 57822ab2b36eee061bc840050167397567c2d671 Mon Sep 17 00:00:00 2001 From: Evie Gauthier Date: Wed, 4 Mar 2026 19:28:07 -0500 Subject: [PATCH 3/3] style: fix prettier formatting on delete button --- src/app/features/room/message/Message.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/features/room/message/Message.tsx b/src/app/features/room/message/Message.tsx index ab2b7620..65a88f9f 100644 --- a/src/app/features/room/message/Message.tsx +++ b/src/app/features/room/message/Message.tsx @@ -507,7 +507,11 @@ function MessageInternal( )} {canDeleteFailedSend && ( - )}