From 327782835eb41567c6d0ce19f47c81dc51189127 Mon Sep 17 00:00:00 2001 From: Deep Tailor Date: Thu, 28 Mar 2019 13:54:27 -0700 Subject: [PATCH] save object before triggering mutate (#2336) --- platform/commonUI/edit/src/actions/SaveAsAction.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/platform/commonUI/edit/src/actions/SaveAsAction.js b/platform/commonUI/edit/src/actions/SaveAsAction.js index 0388838657..055be8c520 100644 --- a/platform/commonUI/edit/src/actions/SaveAsAction.js +++ b/platform/commonUI/edit/src/actions/SaveAsAction.js @@ -162,9 +162,6 @@ function ( function saveAfterClone(clonedObject) { return this.openmct.editor.save().then(() => { // Force mutation for search indexing - clonedObject.useCapability('mutation', (model) => { - return model; - }); return clonedObject; }) } @@ -173,6 +170,14 @@ function ( return fetchObject(clonedObject.getId()) } + function indexForSearch(savedObject) { + savedObject.useCapability('mutation', (model) => { + return model; + }); + + return savedObject; + } + function onSuccess(object) { self.notificationService.info("Save Succeeded"); return object; @@ -194,6 +199,7 @@ function ( .then(undirtyOriginals) .then(saveAfterClone) .then(finishEditing) + .then(indexForSearch) .then(hideBlockingDialog) .then(onSuccess) .catch(onFailure);