From 157c9e7cfac8d0afa27963be81623b23a9c96955 Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Thu, 7 Nov 2024 13:51:39 +0100 Subject: [PATCH] fix replying to reply requires postCid in new API --- src/components/reply-modal/reply-modal.tsx | 6 +++++- src/hooks/use-publish-reply.ts | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/reply-modal/reply-modal.tsx b/src/components/reply-modal/reply-modal.tsx index d7c4bfce..aae794bd 100644 --- a/src/components/reply-modal/reply-modal.tsx +++ b/src/components/reply-modal/reply-modal.tsx @@ -31,7 +31,11 @@ interface ReplyModalProps { const ReplyModal = ({ closeModal, showReplyModal, parentCid, postCid, scrollY, subplebbitAddress }: ReplyModalProps) => { const { t } = useTranslation(); - const { setPublishReplyOptions, publishReply, resetPublishReplyOptions, replyIndex } = usePublishReply({ cid: parentCid, subplebbitAddress }); + const { setPublishReplyOptions, publishReply, resetPublishReplyOptions, replyIndex } = usePublishReply({ + cid: parentCid, + subplebbitAddress, + postCid, + }); const account = useAccount(); const { displayName } = account?.author || {}; const [url, setUrl] = useState(''); diff --git a/src/hooks/use-publish-reply.ts b/src/hooks/use-publish-reply.ts index a6cd90cf..ccb64d81 100644 --- a/src/hooks/use-publish-reply.ts +++ b/src/hooks/use-publish-reply.ts @@ -3,7 +3,7 @@ import { Comment, useAccount, usePublishComment } from '@plebbit/plebbit-react-h import useAnonMode from './use-anon-mode'; import usePublishReplyStore from '../stores/use-publish-reply-store'; -const usePublishReply = ({ cid, subplebbitAddress }: { cid: string; subplebbitAddress: string }) => { +const usePublishReply = ({ cid, subplebbitAddress, postCid }: { cid: string; subplebbitAddress: string; postCid?: string }) => { const parentCid = cid; const account = useAccount(); const { anonMode } = useAnonMode(); @@ -26,6 +26,7 @@ const usePublishReply = ({ cid, subplebbitAddress }: { cid: string; subplebbitAd const newOptions: Comment = { subplebbitAddress, parentCid, + postCid: postCid ?? parentCid, content: options.content === '' ? undefined : options.content ?? content, link: options.link === '' ? undefined : options.link ?? link, spoiler: options.spoiler ?? spoiler,