title: Handlebars function causing tight loop in code
body: <p>I seem to have hit a snag in my app that is causing the browser to go into a very tight loop that never ends.</p>
  
  <p>In the app I have an unload function on a route that increments a value to count and display the number of times a project has been viewed.</p>
  
  <pre><code>   unload: function() {
        var project = projectDocs.findOne(this.params._id);
        // need to increment views value by one
        projectDocs.update(project._id,
          {$inc: {views: 1}}
        );
      }
     });
  </code></pre>
  
  <p>This works fine, until I try and enable a button on the form based on a role the user is in (using the roles package). The code to enable the button is as follows (just in a div).</p>
  
  <pre><code> &lt;a href="{{pathFor 'home'}}" class="btn btn-success {{#unless canQuote}} disabled {{/unless}}"&gt;Quote&lt;/a&gt;
  </code></pre>
  
  <p>The canQuote helper is</p>
  
  <pre><code>Template.projectPage.helpers({
    canQuote: function(){
      return Roles.userIsInRole(this.userId, ['tradie','admin'])
    },
    isOwner: function(){
      return this.userId == Meteor.userId();
    } 
  });
  </code></pre>
  
  <p>This all works fine UNTIL a user is logged in. The button is disabled and all is good. When a user logs in with the appropriate role, the page simply hangs trying to display, and the viewed count just goes up in what can only be a very tight loop somewhere.</p>
  
  <p>Can someone give me a clue why this is looping?</p>
  
  <p>Ta</p>
  
  <p>Peter.</p>