From 5f353101baae9e5cf1a2d8c6ab609d07f45dd60d Mon Sep 17 00:00:00 2001
From: chris <kokosias@yahoo.gr>
Date: Thu, 24 Sep 2020 18:36:18 +0300
Subject: [PATCH] recalculate tops when active changes

---
 .../src/components/comments/ConnectedComment.js             | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/wax-prosemirror-components/src/components/comments/ConnectedComment.js b/wax-prosemirror-components/src/components/comments/ConnectedComment.js
index 7504c4daf..dea7c8b56 100644
--- a/wax-prosemirror-components/src/components/comments/ConnectedComment.js
+++ b/wax-prosemirror-components/src/components/comments/ConnectedComment.js
@@ -47,7 +47,10 @@ export default ({ comment, top, commentId, recalculateTops }) => {
   const commentPlugin = app.PmPlugins.get('commentPlugin');
   const activeComment = commentPlugin.getState(activeView.state).comment;
 
-  if (activeComment && commentId === activeComment.attrs.id) active = true;
+  if (activeComment && commentId === activeComment.attrs.id) {
+    active = true;
+    recalculateTops();
+  }
 
   const onClickPost = content => {
     // TODO find out why on enter comment posts twice.
@@ -101,7 +104,6 @@ export default ({ comment, top, commentId, recalculateTops }) => {
     );
 
     view[viewId].focus();
-    recalculateTops();
     return true;
   };
 
-- 
GitLab