couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject [1/2] fauxton commit: updated refs/heads/master to 6583275
Date Mon, 27 Jun 2016 09:53:13 GMT
Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master c1fa250dd -> 6583275ad


provide debugging help for monkey patched established methods

inheritance is so ridiculous. inheritance in javascript is
just monkey patching. today i spent 8 hrs to finding a bug where
a promise failed silently in a monkey patched route object.

i found it by stringifying a function at runtime with
`console.log(this.establish.toString());` in the renderpipeline
which calls establish on the routeobjects.

the promise in the establish fails, the whole renderpipeline
fails silently and the breadcrumbs component is not rendered.

this commit will make finding those issues in the future a lot
easier

PR: #731
PR-URL: https://github.com/apache/couchdb-fauxton/pull/731
Reviewed-By: garren smith <garren.smith@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/6583275a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/6583275a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/6583275a

Branch: refs/heads/master
Commit: 6583275ad04bd83994c5f17e1e1f764cee5667bf
Parents: e8fbed0
Author: Robert Kowalski <robertkowalski@apache.org>
Authored: Fri Jun 17 19:43:49 2016 +0200
Committer: Robert Kowalski <robertkowalski@apache.org>
Committed: Mon Jun 27 11:52:13 2016 +0200

----------------------------------------------------------------------
 app/core/routeObject.js | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6583275a/app/core/routeObject.js
----------------------------------------------------------------------
diff --git a/app/core/routeObject.js b/app/core/routeObject.js
index 6d9060a..00a37a0 100644
--- a/app/core/routeObject.js
+++ b/app/core/routeObject.js
@@ -102,17 +102,27 @@ _.extend(RouteObject.prototype, Backbone.Events, {
         establishError = _.bind(this.establishError, this),
         renderComplete = _.bind(this.renderComplete, this),
         callEstablish = _.bind(this.callEstablish, this),
-        renderReactComponents = _.bind(this.renderReactComponents, this),
-        promise = this.establish();
+        renderReactComponents = _.bind(this.renderReactComponents, this);
+
+    const promise = this.establish();
 
     // Only start the view rendering process once the template has been rendered
     // otherwise we get double renders
     promiseLayout.then(function () {
       renderReactComponents();
+
       callEstablish(promise)
         .then(renderAllViews, establishError)
-        .then(renderComplete);
-    });
+        .then(renderComplete, (err) => {
+          console.error('renderpipeline broke');
+          console.error('check your establish method');
+
+          console.log(this.establish.toString());
+          console.error(err);
+        });
+
+
+    }.bind(this));
   },
 
   setTemplateOnFullRender: function (masterLayout) {


Mime
View raw message