title: Meteor RangeError: Maximum call stack size exceeded. on keypress event
body: <p>Im trying to make a search box to filter down results of my returned collection in the client.</p>
  
  <p>however when i actually try searching I'm getting the above error in the console.</p>
  
  <pre><code>RangeError: Maximum call stack size exceeded.
  </code></pre>
  
  <p>here is a look at my code.</p>
  
  <pre><code>&lt;body&gt;
  {{#isolate}}
   &lt;header class="row-fluid"&gt;
    {{&gt; modules}}
   &lt;/header&gt;
  {{/isolate}}
  
  &lt;div id="main" class="span11"&gt;
   {{#if currentUser}}
  
   {{#isolate}}
    {{&gt; customers_list}}
   {{/isolate}}   
  
   {{#isolate}}
    {{&gt; contacts_list}}
   {{/isolate}}
  
   {{/if}}
  &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>my search form in inside the modules template</p>
  
  <pre><code>&lt;template name="modules"&gt;
   {{templateLogger "modules"}}
    &lt;ul id="module_list" class="nav"&gt;
   {{#each list}}
    &lt;li&gt;
     &lt;a href="#" id="module_{{_id}}" module_id="{{_id}}" class="module"&gt;{{name}}&lt;/a&gt;
    &lt;/li&gt;
   {{/each}}
    &lt;form&gt;&lt;input type="text" id="search"&gt;&lt;/form&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p></p>
  
  <p>and my customers_list template that I'm trying to filter the results</p>
  
  <pre><code>&lt;template name="customers_list"&gt;
   &lt;table class="table"&gt;
    &lt;tr&gt;
     &lt;th&gt;Name&lt;/th&gt;
     &lt;th&gt;Address&lt;/th&gt;
     &lt;th&gt;City&lt;/th&gt;
     &lt;th&gt;State&lt;/th&gt;
     &lt;th&gt;Zip&lt;/th&gt;
     &lt;th&gt;Phone&lt;/th&gt;
    &lt;/tr&gt;
  
   {{#each record}}
    &lt;tr&gt;
     &lt;td&gt;{{name}}&lt;/td&gt;
     &lt;td&gt;{{address}}&lt;/td&gt;
     &lt;td&gt;{{city}}&lt;/td&gt;
     &lt;td&gt;{{state}}&lt;/td&gt;
     &lt;td&gt;{{zip}}&lt;/td&gt;
     &lt;td&gt;{{phone}}&lt;/td&gt;
    &lt;/tr&gt;
   {{/each}}
   &lt;/table&gt;
  &lt;/template&gt;
  </code></pre>
  
  <p>and here is the event handler for the search form</p>
  
  <pre><code>Template.modules.events({
   'keypress input#search': function (event) {
    Session.set("currentFilter", $('input#search'));
   }
  });
  </code></pre>
  
  <p>and the form helper do display the results </p>
  
  <pre><code>Template.customers_list.record = function() {
   qry = Session.get("currentFilter") || "";
   if (qry != "") {
    return Customers.find({$or: [ {'name': qry}, {'address': qry}, {'city': qry}, {'state': qry} ] });
   } else {
    return Customers.find({competitor: null}, {sort: {name: 1}});
   };
  }
  </code></pre>
  
  <p>I have no clue what the is causing this error from what i was able to read on other SO posts about the error it seems like its a infinite loop however those were not meteor specific questions and i don't know if that would make a difference? also if there is an infinite loop i cant find it.</p>
  
  <p>any help would be grateful.</p>