couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gar...@apache.org
Subject [couchdb-fauxton] branch master updated: Update code editor's contents when a new Document is loaded (#987)
Date Mon, 02 Oct 2017 07:19:09 GMT
This is an automated email from the ASF dual-hosted git repository.

garren pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git


The following commit(s) were added to refs/heads/master by this push:
     new 7066f72  Update code editor's contents when a new Document is loaded (#987)
7066f72 is described below

commit 7066f72cc492e448525360a43755f91bc9070b7d
Author: Antonio Maranhao <30349380+Antonio-Maranhao@users.noreply.github.com>
AuthorDate: Mon Oct 2 03:19:07 2017 -0400

    Update code editor's contents when a new Document is loaded (#987)
---
 app/addons/documents/doc-editor/components.js | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/app/addons/documents/doc-editor/components.js b/app/addons/documents/doc-editor/components.js
index 71e4915..1da1f1c 100644
--- a/app/addons/documents/doc-editor/components.js
+++ b/app/addons/documents/doc-editor/components.js
@@ -84,9 +84,11 @@ var DocEditorController = React.createClass({
     store.off('change', this.onChange);
   },
 
-  // whenever a file is uploaded or a doc is cloned update the editor
   componentWillUpdate: function (nextProps, nextState) {
-    if (this.state.numFilesUploaded !== nextState.numFilesUploaded || this.state.doc &&
this.state.doc.hasChanged()) {
+    // Update the editor whenever a file is uploaded, a doc is cloned, or a new doc is loaded
+    if (this.state.numFilesUploaded !== nextState.numFilesUploaded ||
+        this.state.doc && this.state.doc.hasChanged() ||
+        (this.state.doc && nextState.doc && this.state.doc.id !== nextState.doc.id))
{
       this.getEditor().setValue(JSON.stringify(nextState.doc.attributes, null, '  '));
       this.onSaveComplete();
     }

-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <commits@couchdb.apache.org>'].

Mime
View raw message