From 904e93bd8e1088449d48885d9f302eba109c78c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Thu, 22 Sep 2022 22:00:32 +0200 Subject: [PATCH 1/2] Fix ReplyMentionsModal crash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- app/soapbox/features/compose/components/reply_mentions.tsx | 4 +++- app/soapbox/features/ui/components/reply_mentions_modal.tsx | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/soapbox/features/compose/components/reply_mentions.tsx b/app/soapbox/features/compose/components/reply_mentions.tsx index 577334281..865f6539d 100644 --- a/app/soapbox/features/compose/components/reply_mentions.tsx +++ b/app/soapbox/features/compose/components/reply_mentions.tsx @@ -36,7 +36,9 @@ const ReplyMentions: React.FC = ({ composeId }) => { const handleClick = (e: React.MouseEvent) => { e.preventDefault(); - dispatch(openModal('REPLY_MENTIONS')); + dispatch(openModal('REPLY_MENTIONS', { + composeId, + })); }; if (!parentTo || (parentTo.size === 0)) { diff --git a/app/soapbox/features/ui/components/reply_mentions_modal.tsx b/app/soapbox/features/ui/components/reply_mentions_modal.tsx index 43aaa24c4..2c8fc73b1 100644 --- a/app/soapbox/features/ui/components/reply_mentions_modal.tsx +++ b/app/soapbox/features/ui/components/reply_mentions_modal.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useCallback } from 'react'; import { FormattedMessage } from 'react-intl'; import { Modal } from 'soapbox/components/ui'; @@ -18,7 +18,8 @@ interface IReplyMentionsModal { const ReplyMentionsModal: React.FC = ({ composeId, onClose }) => { const compose = useCompose(composeId); - const status = useAppSelector(state => makeGetStatus()(state, { id: compose.in_reply_to! })); + const getStatus = useCallback(makeGetStatus(), []); + const status = useAppSelector(state => getStatus(state, { id: compose.in_reply_to! })); const account = useAppSelector((state) => state.accounts.get(state.me)); const mentions = statusToMentionsAccountIdsArray(status!, account!); From c1618026a79e5b7b1a447c4a9e9c254ca8bbef19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Fri, 23 Sep 2022 23:12:44 +0200 Subject: [PATCH 2/2] Fix share route MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- app/soapbox/features/share/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/soapbox/features/share/index.tsx b/app/soapbox/features/share/index.tsx index 562f23689..fdb5caa3d 100644 --- a/app/soapbox/features/share/index.tsx +++ b/app/soapbox/features/share/index.tsx @@ -19,7 +19,7 @@ const Share = () => { .join('\n\n'); if (text) { - dispatch(openComposeWithText(text)); + dispatch(openComposeWithText('compose-modal', text)); } return ( @@ -27,4 +27,4 @@ const Share = () => { ); }; -export default Share; \ No newline at end of file +export default Share;