fix eslint

This commit is contained in:
Tom
2023-05-25 21:03:17 +02:00
parent 9c537b6286
commit bb54704a89
3 changed files with 11 additions and 10 deletions
+5 -4
View File
@@ -114,11 +114,12 @@ const Board = () => {
setOpenMenuCid(null); setOpenMenuCid(null);
}; };
const handleOutsideClick = (e) => { const handleOutsideClick = useCallback((e) => {
if (openMenuCid !== null && !postMenuRef.current.contains(e.target) && !postMenuCatalogRef.current.contains(e.target)) { if (openMenuCid !== null && !postMenuRef.current.contains(e.target) && !postMenuCatalogRef.current.contains(e.target)) {
setOpenMenuCid(null); setOpenMenuCid(null);
} }
}; }, [openMenuCid, postMenuRef, postMenuCatalogRef]);
useEffect(() => { useEffect(() => {
if (openMenuCid !== null) { if (openMenuCid !== null) {
@@ -130,7 +131,7 @@ const Board = () => {
return () => { return () => {
document.removeEventListener('click', handleOutsideClick); document.removeEventListener('click', handleOutsideClick);
}; };
}, [openMenuCid]); }, [openMenuCid, handleOutsideClick]);
@@ -458,7 +459,7 @@ const Board = () => {
if (editedComment !== '') { if (editedComment !== '') {
setTriggerPublishCommentEdit(true); setTriggerPublishCommentEdit(true);
} }
}, [editedComment]); }, [editedComment, setIsAuthorEdit]);
useEffect(() => { useEffect(() => {
+3 -3
View File
@@ -103,11 +103,11 @@ const Catalog = () => {
setOpenMenuCid(null); setOpenMenuCid(null);
}; };
const handleOutsideClick = (e) => { const handleOutsideClick = useCallback((e) => {
if (openMenuCid !== null && !postMenuRef.current.contains(e.target) && !postMenuCatalogRef.current.contains(e.target)) { if (openMenuCid !== null && !postMenuRef.current.contains(e.target) && !postMenuCatalogRef.current.contains(e.target)) {
setOpenMenuCid(null); setOpenMenuCid(null);
} }
}; }, [openMenuCid, postMenuRef, postMenuCatalogRef]);
useEffect(() => { useEffect(() => {
if (openMenuCid !== null) { if (openMenuCid !== null) {
@@ -119,7 +119,7 @@ const Catalog = () => {
return () => { return () => {
document.removeEventListener('click', handleOutsideClick); document.removeEventListener('click', handleOutsideClick);
}; };
}, [openMenuCid]); }, [openMenuCid, handleOutsideClick]);
+3 -3
View File
@@ -116,11 +116,11 @@ const Thread = () => {
setOpenMenuCid(null); setOpenMenuCid(null);
}; };
const handleOutsideClick = (e) => { const handleOutsideClick = useCallback((e) => {
if (openMenuCid !== null && !postMenuRef.current.contains(e.target) && !postMenuCatalogRef.current.contains(e.target)) { if (openMenuCid !== null && !postMenuRef.current.contains(e.target) && !postMenuCatalogRef.current.contains(e.target)) {
setOpenMenuCid(null); setOpenMenuCid(null);
} }
}; }, [openMenuCid, postMenuRef, postMenuCatalogRef]);
useEffect(() => { useEffect(() => {
if (openMenuCid !== null) { if (openMenuCid !== null) {
@@ -132,7 +132,7 @@ const Thread = () => {
return () => { return () => {
document.removeEventListener('click', handleOutsideClick); document.removeEventListener('click', handleOutsideClick);
}; };
}, [openMenuCid]); }, [openMenuCid, handleOutsideClick]);
useEffect(() => { useEffect(() => {