diff --git a/src/components/modals/ModerationModal.jsx b/src/components/modals/ModerationModal.jsx index fcd53b09..44caad8d 100755 --- a/src/components/modals/ModerationModal.jsx +++ b/src/components/modals/ModerationModal.jsx @@ -130,13 +130,20 @@ const ModerationModal = ({ isOpen, closeModal, deletePost }) => { useEffect(() => { + let isActive = true; if (publishCommentEditOptions && triggerPublishCommentEdit) { (async () => { await publishCommentEdit(); - setTriggerPublishCommentEdit(false); + if (isActive) { + setTriggerPublishCommentEdit(false); + } })(); } - }, [publishCommentEditOptions, triggerPublishCommentEdit, publishCommentEdit]); + + return () => { + isActive = false; + }; + }, [triggerPublishCommentEdit, publishCommentEdit, publishCommentEditOptions]); diff --git a/src/components/views/All.jsx b/src/components/views/All.jsx index 188c08ed..34dd3b47 100755 --- a/src/components/views/All.jsx +++ b/src/components/views/All.jsx @@ -416,13 +416,20 @@ const All = () => { useEffect(() => { + let isActive = true; if (publishCommentEditOptions && triggerPublishCommentEdit) { (async () => { await publishCommentEdit(); - setTriggerPublishCommentEdit(false); + if (isActive) { + setTriggerPublishCommentEdit(false); + } })(); } - }, [publishCommentEditOptions, triggerPublishCommentEdit, publishCommentEdit]); + + return () => { + isActive = false; + }; + }, [triggerPublishCommentEdit, publishCommentEdit, publishCommentEditOptions]); // desktop navbar board select functionality const handleClickTitle = (title, address) => { diff --git a/src/components/views/AllCatalog.jsx b/src/components/views/AllCatalog.jsx index ec08f7f5..63fa7b1c 100755 --- a/src/components/views/AllCatalog.jsx +++ b/src/components/views/AllCatalog.jsx @@ -278,13 +278,20 @@ const AllCatalog = () => { useEffect(() => { + let isActive = true; if (publishCommentEditOptions && triggerPublishCommentEdit) { (async () => { await publishCommentEdit(); - setTriggerPublishCommentEdit(false); + if (isActive) { + setTriggerPublishCommentEdit(false); + } })(); } - }, [publishCommentEditOptions, triggerPublishCommentEdit, publishCommentEdit]); + + return () => { + isActive = false; + }; + }, [triggerPublishCommentEdit, publishCommentEdit, publishCommentEditOptions]); // mobile navbar board select functionality diff --git a/src/components/views/Board.jsx b/src/components/views/Board.jsx index 74223bdb..11a8b1e3 100755 --- a/src/components/views/Board.jsx +++ b/src/components/views/Board.jsx @@ -546,13 +546,21 @@ const Board = () => { useEffect(() => { + let isActive = true; if (publishCommentEditOptions && triggerPublishCommentEdit) { (async () => { await publishCommentEdit(); - setTriggerPublishCommentEdit(false); + if (isActive) { + setTriggerPublishCommentEdit(false); + } })(); } - }, [publishCommentEditOptions, triggerPublishCommentEdit, publishCommentEdit]); + + return () => { + isActive = false; + }; + }, [triggerPublishCommentEdit, publishCommentEdit, publishCommentEditOptions]); + // desktop navbar board select functionality const handleClickTitle = (title, address) => { diff --git a/src/components/views/Subscriptions.jsx b/src/components/views/Subscriptions.jsx index 5eeb9b60..a6067f87 100755 --- a/src/components/views/Subscriptions.jsx +++ b/src/components/views/Subscriptions.jsx @@ -418,13 +418,20 @@ const Subscriptions = () => { useEffect(() => { + let isActive = true; if (publishCommentEditOptions && triggerPublishCommentEdit) { (async () => { await publishCommentEdit(); - setTriggerPublishCommentEdit(false); + if (isActive) { + setTriggerPublishCommentEdit(false); + } })(); } - }, [publishCommentEditOptions, triggerPublishCommentEdit, publishCommentEdit]); + + return () => { + isActive = false; + }; + }, [triggerPublishCommentEdit, publishCommentEdit, publishCommentEditOptions]); // desktop navbar board select functionality const handleClickTitle = (title, address) => { diff --git a/src/components/views/SubscriptionsCatalog.jsx b/src/components/views/SubscriptionsCatalog.jsx index ef0762c8..34ee696a 100755 --- a/src/components/views/SubscriptionsCatalog.jsx +++ b/src/components/views/SubscriptionsCatalog.jsx @@ -275,13 +275,20 @@ const SubscriptionsCatalog = () => { useEffect(() => { + let isActive = true; if (publishCommentEditOptions && triggerPublishCommentEdit) { (async () => { await publishCommentEdit(); - setTriggerPublishCommentEdit(false); + if (isActive) { + setTriggerPublishCommentEdit(false); + } })(); } - }, [publishCommentEditOptions, triggerPublishCommentEdit, publishCommentEdit]); + + return () => { + isActive = false; + }; + }, [triggerPublishCommentEdit, publishCommentEdit, publishCommentEditOptions]); // desktop navbar board select functionality const handleClickTitle = (title, address) => { diff --git a/src/components/views/Thread.jsx b/src/components/views/Thread.jsx index 9c10b658..ad6f7a66 100755 --- a/src/components/views/Thread.jsx +++ b/src/components/views/Thread.jsx @@ -509,13 +509,20 @@ const Thread = () => { useEffect(() => { + let isActive = true; if (publishCommentEditOptions && triggerPublishCommentEdit) { (async () => { await publishCommentEdit(); - setTriggerPublishCommentEdit(false); + if (isActive) { + setTriggerPublishCommentEdit(false); + } })(); } - }, [publishCommentEditOptions, triggerPublishCommentEdit, publishCommentEdit]); + + return () => { + isActive = false; + }; + }, [triggerPublishCommentEdit, publishCommentEdit, publishCommentEditOptions]); // mobile navbar board select functionality const handleSelectChange = (event) => {