You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by sh...@apache.org on 2024/04/10 02:49:40 UTC

(incubator-answer) branch dev updated: fix: sometimes the comment link in the notification cannot be highlighted after clicking

This is an automated email from the ASF dual-hosted git repository.

shuai pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git


The following commit(s) were added to refs/heads/dev by this push:
     new d476f1ce fix: sometimes the comment link in the notification cannot be highlighted after clicking
d476f1ce is described below

commit d476f1ce9ffd5135e4efba8d7fd1f273cbd6e5b9
Author: hgaol <dh...@hotmail.com>
AuthorDate: Tue Apr 9 22:35:00 2024 +0800

    fix: sometimes the comment link in the notification cannot be highlighted after clicking
---
 ui/src/components/Comment/index.tsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ui/src/components/Comment/index.tsx b/ui/src/components/Comment/index.tsx
index 06ecfc26..9521ab55 100644
--- a/ui/src/components/Comment/index.tsx
+++ b/ui/src/components/Comment/index.tsx
@@ -73,7 +73,7 @@ const Comment = ({ objectId, mode, commentId }) => {
   const { t } = useTranslation('translation', { keyPrefix: 'comment' });
 
   useEffect(() => {
-    if (pageIndex === 0 && commentId) {
+    if (pageIndex === 0 && commentId && comments.length !== 0) {
       setTimeout(() => {
         const el = document.getElementById(commentId);
         scrollToElementTop(el);
@@ -84,7 +84,7 @@ const Comment = ({ objectId, mode, commentId }) => {
     return () => {
       updateCurrentReplyId('');
     };
-  }, []);
+  }, [comments]);
 
   useEffect(() => {
     if (!data) {