From 9543f16f683d2d90041edab895a571d30a30baae Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Thu, 29 Aug 2024 15:00:21 +0200 Subject: [PATCH] fix(edit menu): couldn't edit post content if post was just published --- src/components/edit-menu/edit-menu.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/edit-menu/edit-menu.tsx b/src/components/edit-menu/edit-menu.tsx index e8520eaa..70c8464e 100644 --- a/src/components/edit-menu/edit-menu.tsx +++ b/src/components/edit-menu/edit-menu.tsx @@ -1,4 +1,4 @@ -import { useState } from 'react'; +import { useEffect, useState } from 'react'; import { Trans, useTranslation } from 'react-i18next'; import { autoUpdate, FloatingFocusManager, offset, shift, useClick, useDismiss, useFloating, useId, useInteractions, useRole } from '@floating-ui/react'; import { Comment, PublishCommentEditOptions, usePublishCommentEdit } from '@plebbit/plebbit-react-hooks'; @@ -101,6 +101,13 @@ const EditMenu = ({ isAccountMod, isAccountCommentAuthor, isCommentAuthorMod, po const headingId = useId(); + useEffect(() => { + setPublishCommentEditOptions((prevOptions) => ({ + ...prevOptions, + commentCid: cid, + })); + }, [cid]); + const _publishCommentEdit = async () => { try { await publishCommentEdit();