couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowalski <...@git.apache.org>
Subject [GitHub] couchdb-fauxton pull request: Built in React support in route obje...
Date Wed, 08 Apr 2015 09:56:13 GMT
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/352#discussion_r27956611
  
    --- Diff: app/core/routeObject.js ---
    @@ -229,10 +239,34 @@ function (FauxtonAPI, Backbone) {
         },
     
         setView: function (selector, view) {
    +      this.removeView(selector);
    +      this.removeComponent(selector);
           this.views[selector] = view;
           return view;
         },
     
    +    setComponent: function (selector, component) {
    +      this.removeView(selector);
    +      this.removeComponent(selector);
    +      this.reactComponents[selector] = component;
    +    },
    +
    +    removeComponent: function (selector) {
    +      if (_.has(this.reactComponents, selector)) {
    +        React.unmountComponentAtNode($(selector)[0]);
    +        this.reactComponents[selector] = null;
    +        delete this.reactComponents[selector];
    +      }
    +    },
    +
    +    removeComponents: function () {
    +      _.each(this.reactComponents, function (component, selector) {
    +        this.removeComponent(selector);
    +      }, this);
    +
    +      this.reactComponents = {};
    +    },
    +
    --- End diff --
    
    can you write a few unit tests for those methods?
    
    You will probably need https://github.com/apache/couchdb-fauxton/pull/356 before, going
to merge it now


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message