matteodem / meteor-easy-search

Easy-to-use search for Meteor with Blaze Components
MIT License
436 stars 68 forks source link

Possible race condition in getComponentMethods? #524

Closed Neobii closed 8 years ago

Neobii commented 8 years ago

I'm trying
var results = SearchIndex.getComponentMethods().getCursor().fetch();

and this error pops up Exception in template helper: Error: Component with name '__default' not found [no-component]

Neobii commented 8 years ago

I found out that I called getComponentMethods sometimes before the search input was loaded because they exist in different templates. I was expecting to get the results as if the user hasn't searched yet whether the search input has been loaded or not.

matteodem commented 8 years ago

you need to put this code in to the onRendered or onCreated hook of a template.