From df963607776848c5eb127a8e52257a665af876f6 Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Sun, 26 Jan 2025 22:25:56 +0100 Subject: [PATCH] forgot initialization --- src/components/post-form/post-form.tsx | 12 ++++++++++++ src/components/reply-modal/reply-modal.tsx | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/src/components/post-form/post-form.tsx b/src/components/post-form/post-form.tsx index 2227f388..1f298758 100644 --- a/src/components/post-form/post-form.tsx +++ b/src/components/post-form/post-form.tsx @@ -248,6 +248,18 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid: } }; + const hasInitializedDisplayName = useRef(false); + useEffect(() => { + if (displayName && !hasInitializedDisplayName.current) { + hasInitializedDisplayName.current = true; + if (isInPostView) { + setPublishReplyOptions({ displayName }); + } else { + setPublishPostStore({ displayName }); + } + } + }, [displayName, isInPostView]); + return ( diff --git a/src/components/reply-modal/reply-modal.tsx b/src/components/reply-modal/reply-modal.tsx index 58768337..41d690c2 100644 --- a/src/components/reply-modal/reply-modal.tsx +++ b/src/components/reply-modal/reply-modal.tsx @@ -222,6 +222,14 @@ const ReplyModal = ({ closeModal, showReplyModal, parentCid, postCid, scrollY, s } }; + const hasInitializedDisplayName = useRef(false); + useEffect(() => { + if (displayName && !hasInitializedDisplayName.current) { + hasInitializedDisplayName.current = true; + setPublishReplyOptions({ displayName }); + } + }, [displayName]); + const modalContent = (