From 74400dad9712a884adcb1bb6c17656db5e217d34 Mon Sep 17 00:00:00 2001 From: zadam Date: Thu, 15 Jun 2023 21:51:41 +0200 Subject: [PATCH] fix race condition between script execution and saving, closes #4028 --- src/public/app/widgets/note_detail.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/public/app/widgets/note_detail.js b/src/public/app/widgets/note_detail.js index aaf2c568d..2346c041e 100644 --- a/src/public/app/widgets/note_detail.js +++ b/src/public/app/widgets/note_detail.js @@ -230,6 +230,15 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { } } + async runActiveNoteCommand(params) { + if (this.isNoteContext(params.ntxId)) { + // make sure that script is saved before running it #4028 + await this.spacedUpdate.updateNowIfNecessary(); + } + + return await this.parent.triggerCommand('runActiveNote', params); + } + async printActiveNoteEvent() { if (!this.noteContext.isActive()) { return;