Merge branch 'fix-reply-mentions-modal' into 'develop'
Fix ReplyMentionsModal crash Closes #1108 See merge request soapbox-pub/soapbox!1798
This commit is contained in:
commit
836ff09a3d
2 changed files with 6 additions and 3 deletions
|
@ -36,7 +36,9 @@ const ReplyMentions: React.FC<IReplyMentions> = ({ composeId }) => {
|
||||||
const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
|
const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
dispatch(openModal('REPLY_MENTIONS'));
|
dispatch(openModal('REPLY_MENTIONS', {
|
||||||
|
composeId,
|
||||||
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!parentTo || (parentTo.size === 0)) {
|
if (!parentTo || (parentTo.size === 0)) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import React from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
import { Modal } from 'soapbox/components/ui';
|
import { Modal } from 'soapbox/components/ui';
|
||||||
|
@ -18,7 +18,8 @@ interface IReplyMentionsModal {
|
||||||
const ReplyMentionsModal: React.FC<IReplyMentionsModal> = ({ composeId, onClose }) => {
|
const ReplyMentionsModal: React.FC<IReplyMentionsModal> = ({ composeId, onClose }) => {
|
||||||
const compose = useCompose(composeId);
|
const compose = useCompose(composeId);
|
||||||
|
|
||||||
const status = useAppSelector<StatusEntity | null>(state => makeGetStatus()(state, { id: compose.in_reply_to! }));
|
const getStatus = useCallback(makeGetStatus(), []);
|
||||||
|
const status = useAppSelector<StatusEntity | null>(state => getStatus(state, { id: compose.in_reply_to! }));
|
||||||
const account = useAppSelector((state) => state.accounts.get(state.me));
|
const account = useAppSelector((state) => state.accounts.get(state.me));
|
||||||
|
|
||||||
const mentions = statusToMentionsAccountIdsArray(status!, account!);
|
const mentions = statusToMentionsAccountIdsArray(status!, account!);
|
||||||
|
|
Loading…
Reference in a new issue