From 03d9d0521b8208143b7011953ce80e341625d247 Mon Sep 17 00:00:00 2001
From: chris <kokosias@yahoo.gr>
Date: Fri, 10 Jul 2020 23:53:35 +0300
Subject: [PATCH] better track tracking in notes

---
 wax-prosemirror-core/src/WaxView.js             | 17 +++++++++++------
 .../src/NoteService/Editor.js                   |  2 +-
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/wax-prosemirror-core/src/WaxView.js b/wax-prosemirror-core/src/WaxView.js
index c6e06b876..8af701fd1 100644
--- a/wax-prosemirror-core/src/WaxView.js
+++ b/wax-prosemirror-core/src/WaxView.js
@@ -61,13 +61,12 @@ export default props => {
   const dispatchTransaction = transaction => {
     const { TrackChange } = props;
     const group = "main";
-    const tr = TrackChange
-      ? trackedTransaction(transaction, view.state, user, group)
-      : transaction;
 
-    const state = view.state.apply(tr);
-    view.updateState(state);
-    if (!tr.getMeta("fromOutsideView")) {
+    /*when a transaction comes from a view other than
+    main don't keep updating the view ,as this this
+    the central point of each transaction
+    */
+    if (!transaction.getMeta("fromOutsideView")) {
       context.updateView(
         {
           main: view
@@ -75,6 +74,12 @@ export default props => {
         "main"
       );
     }
+    const tr = TrackChange
+      ? trackedTransaction(transaction, view.state, user, group)
+      : transaction;
+
+    const state = view.state.apply(tr);
+    view.updateState(state);
 
     props.onChange(state.doc.content);
   };
diff --git a/wax-prosemirror-services/src/NoteService/Editor.js b/wax-prosemirror-services/src/NoteService/Editor.js
index 208cf6089..64a714b46 100644
--- a/wax-prosemirror-services/src/NoteService/Editor.js
+++ b/wax-prosemirror-services/src/NoteService/Editor.js
@@ -42,7 +42,7 @@ export default ({ node, view }) => {
           //Set everytime the active view into context
           setTimeout(() => {
             context.updateView({}, noteId);
-          }, 200);
+          }, 20);
 
           if (!tr.getMeta("fromOutside")) {
             let outerTr = view.state.tr,
-- 
GitLab