mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix useEffect loop
This commit is contained in:
@@ -70,6 +70,7 @@ const Board = () => {
|
||||
const [prevScrollPos, setPrevScrollPos] = useState(0);
|
||||
const [visible, setVisible] = useState(true);
|
||||
const [triggerPublishComment, setTriggerPublishComment] = useState(false);
|
||||
const [triggerPublishCommentEdit, setTriggerPublishCommentEdit] = useState(false);
|
||||
const [selectedFeed, setSelectedFeed] = useState(feed);
|
||||
const [rotatedStates, setRotatedStates] = useState({});
|
||||
const [isImageSearchOpen, setIsImageSearchOpen] = useState(false);
|
||||
@@ -402,6 +403,8 @@ const Board = () => {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
setTriggerPublishCommentEdit(true);
|
||||
};
|
||||
|
||||
|
||||
@@ -414,8 +417,13 @@ const Board = () => {
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
publishCommentEdit();
|
||||
}, [publishCommentEditOptions, publishCommentEdit]);
|
||||
if (publishCommentEditOptions && triggerPublishCommentEdit) {
|
||||
(async () => {
|
||||
await publishCommentEdit();
|
||||
setTriggerPublishCommentEdit(false);
|
||||
})();
|
||||
}
|
||||
}, [publishCommentEditOptions, triggerPublishCommentEdit, publishCommentEdit]);
|
||||
|
||||
|
||||
// desktop navbar board select functionality
|
||||
|
||||
@@ -60,6 +60,7 @@ const Thread = () => {
|
||||
const replyMenuRefs = useRef({});
|
||||
|
||||
const [triggerPublishComment, setTriggerPublishComment] = useState(false);
|
||||
const [triggerPublishCommentEdit, setTriggerPublishCommentEdit] = useState(false);
|
||||
const [errorMessage, setErrorMessage] = useState(null);
|
||||
const [successMessage, setSuccessMessage] = useState(null);
|
||||
const [isReplyOpen, setIsReplyOpen] = useState(false);
|
||||
@@ -375,6 +376,8 @@ const Thread = () => {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
setTriggerPublishCommentEdit(true);
|
||||
};
|
||||
|
||||
|
||||
@@ -387,8 +390,13 @@ const Thread = () => {
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
publishCommentEdit();
|
||||
}, [publishCommentEditOptions, publishCommentEdit]);
|
||||
if (publishCommentEditOptions && triggerPublishCommentEdit) {
|
||||
(async () => {
|
||||
await publishCommentEdit();
|
||||
setTriggerPublishCommentEdit(false);
|
||||
})();
|
||||
}
|
||||
}, [publishCommentEditOptions, triggerPublishCommentEdit, publishCommentEdit]);
|
||||
|
||||
// mobile navbar board select functionality
|
||||
const handleSelectChange = (event) => {
|
||||
|
||||
Reference in New Issue
Block a user