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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to