Explorar o código

Fix lint error

Mudana-grune %!s(int64=2) %!d(string=hai) anos
pai
achega
de7085e522

+ 4 - 4
apps/app/src/components/Comments.tsx

@@ -1,4 +1,4 @@
-import React, { useCallback, useEffect, useRef } from 'react';
+import React, { useEffect, useRef } from 'react';
 
 import { type IRevisionHasId, pagePathUtils } from '@growi/core';
 import dynamic from 'next/dynamic';
@@ -70,12 +70,12 @@ export const Comments = (props: CommentsProps): JSX.Element => {
     return <></>;
   }
 
-  const onCommentButtonClickHandler = useCallback(() => {
+  const onCommentButtonClickHandler = () => {
     mutate();
     if (onCommentCountUpdated != null) {
-      onCommentCountUpdated()
+      onCommentCountUpdated();
     }
-  }, [mutate, onCommentCountUpdated]);
+  };
 
   return (
     <div className="page-comments-row mt-5 py-4 d-edit-none d-print-none">

+ 7 - 1
apps/app/src/components/Page/PageView.tsx

@@ -112,7 +112,13 @@ export const PageView = (props: Props): JSX.Element => {
     ? (
       <>
         <div id="comments-container" ref={commentsContainerRef}>
-          <Comments pageId={page._id} pagePath={pagePath} revision={page.revision} onLoaded={() => setCommentsLoaded(true)} onCommentCountUpdated={mutateCurrentPage} />
+          <Comments
+            pageId={page._id}
+            pagePath={pagePath}
+            revision={page.revision}
+            onLoaded={() => setCommentsLoaded(true)}
+            onCommentCountUpdated={mutateCurrentPage}
+          />
         </div>
         {(isUsersHomePagePath && page.creator != null) && (
           <UsersHomePageFooter creatorId={page.creator._id} />

+ 3 - 3
apps/app/src/components/PageComment.tsx

@@ -106,13 +106,13 @@ export const PageComment: FC<PageCommentProps> = memo((props: PageCommentProps):
     setShowEditorIds((previousState) => {
       // Create a new Set of commentId from the previous state
       const updatedShowEditorIds = new Set(previousState);
-      updatedShowEditorIds.delete(commentId);  // Delete the commentId from the Set
+      updatedShowEditorIds.delete(commentId); // Delete the commentId from the Set
       return updatedShowEditorIds;
     });
   }, []);
 
   const onReplyButtonClickHandler = useCallback((commentId: string) => {
-    setShowEditorIds((previousState) => new Set(previousState.add(commentId)));
+    setShowEditorIds(previousState => new Set(previousState.add(commentId)));
   }, []);
 
   const onCommentButtonClickHandler = useCallback((commentId: string) => {
@@ -121,7 +121,7 @@ export const PageComment: FC<PageCommentProps> = memo((props: PageCommentProps):
     if (onCommentCountUpdated != null) {
       onCommentCountUpdated();
     }
-  }, [removeShowEditorId, mutate, onCommentCountUpdated])
+  }, [removeShowEditorId, mutate, onCommentCountUpdated]);
 
   if (hideIfEmpty && comments?.length === 0) {
     return <PageCommentRoot />;