From 93d55b3e7b20c3c2e4aae82d7e7bb566a6c4b26b Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 22 Feb 2021 22:43:54 +0100 Subject: [PATCH] put back waiting for sync after frontend API backend request --- src/public/app/services/frontend_script_api.js | 4 +--- src/public/app/widgets/note_tree.js | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/public/app/services/frontend_script_api.js b/src/public/app/services/frontend_script_api.js index c3b0763c2..561c3b229 100644 --- a/src/public/app/services/frontend_script_api.js +++ b/src/public/app/services/frontend_script_api.js @@ -166,9 +166,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain }, "script"); if (ret.success) { - // we used to wait for max entity change here returned from the response - // but it's too easy to end up in infinite cycle when this is triggered as a consequence of - // sync event (typically from custom widget) + await ws.waitForMaxKnownEntityChangeId(); return ret.executionResult; } diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.js index 4cd75a53c..863436308 100644 --- a/src/public/app/widgets/note_tree.js +++ b/src/public/app/widgets/note_tree.js @@ -1130,7 +1130,8 @@ export default class NoteTreeWidget extends TabAwareWidget { // here note tree is responsible for updating global state of the application // this should be done by tabcontext / tabmanager and note tree should only listen to // changes in active note and just set the "active" state - await appContext.tabManager.getActiveTabContext().setNote(nextNotePath); + // We don't await since that can bring up infinite cycles when e.g. custom widget does some backend requests which wait for max sync ID processed + appContext.tabManager.getActiveTabContext().setNote(nextNotePath); } }