diff --git a/src/app/features/room/message/Message.tsx b/src/app/features/room/message/Message.tsx index 69ee596db..261131b06 100644 --- a/src/app/features/room/message/Message.tsx +++ b/src/app/features/room/message/Message.tsx @@ -445,12 +445,13 @@ export const MessageDeleteItem = as< onClose?: () => void; } >(({ room, mEvent, onClose, ...props }, ref) => { + const mx = useMatrixClient(); const [open, setOpen] = useState(false); const [deleteState, deleteMessage] = useAsyncCallback( useCallback( (eventId: string, reason?: string) => mx.redactEvent(room.roomId, eventId, undefined, reason ? { reason } : undefined), - [room], + [mx, room], ), ); @@ -572,12 +573,13 @@ export const MessageReportItem = as< onClose?: () => void; } >(({ room, mEvent, onClose, ...props }, ref) => { + const mx = useMatrixClient(); const [open, setOpen] = useState(false); const [reportState, reportMessage] = useAsyncCallback( useCallback( (eventId: string, score: number, reason: string) => mx.reportEvent(room.roomId, eventId, score, reason), - [room], + [mx, room], ), );