Template.feed.events({
  'submit [data-id=insert-post-form]': (event, template) => {
    event.preventDefault();

    Meteor.call('posts.insert', template.find('[data-id=body]').value, (error, result) => {
      if (error) {
        Bert.alert(error.reason, 'danger', 'growl-top-right');
      } else {
        Bert.alert('Post successfully submitted', 'success', 'growl-top-right');
        template.find('[data-id=body]').value = '';
      }
    });
  },

  'click [data-id=clear-form]': (event, template) => {
    template.find('[data-id=body]').value = '';
  },

  'click [data-id=load-more]': (event, template) => {
    template.limit.set(template.limit.get() + 20);
  },

  'keyup [data-id=search-query]': _.debounce((event, template) => {
    event.preventDefault();
    template.searchQuery.set(template.find('[data-id=search-query]').value);
    template.limit.set(20);
  }, 300),

  'submit [data-id=search-posts-form]': (event, template) => {
    event.preventDefault();
  }
});

Template.feed.helpers({
  posts: () => {
    const instance = Template.instance();
    if (instance.searchQuery.get()) {
      return Posts.find({}, { sort: [['score', 'desc']] }, { limit: instance.loaded.get() });
    }
    return Posts.find({}, { sort: { createdAt: -1 } }, { limit: instance.loaded.get() });
  },

  hasMorePosts: () => {
    return Template.instance().limit.get() <= Counts.get('posts.all');
  }
});

Template.feed.onCreated(function () {
  this.searchQuery = new ReactiveVar('');
  this.limit = new ReactiveVar(20);
  this.loaded = new ReactiveVar(0);

  this.autorun(() => {
    let subscription = this.subscribe('posts.all', this.searchQuery.get(), this.limit.get());
    if (subscription.ready()) {
      this.loaded.set(this.limit.get());
    }
  });
});

@@ -1164,42 +1164,8 @@
 c'%5D%5D
- %7D, %7B limit: instance.loaded.get()
  %7D);
@@ -1226,42 +1226,8 @@
 -1 %7D
- %7D, %7B limit: instance.loaded.get()
  %7D);
@@ -1456,44 +1456,8 @@
 20);
-%0A  this.loaded = new ReactiveVar(0);
 %0A%0A  
@@ -1484,27 +1484,8 @@
 %0A   
- let subscription =
  thi
@@ -1556,87 +1556,8 @@
 ));%0A
-    if (subscription.ready()) %7B%0A      this.loaded.set(this.limit.get());%0A    %7D%0A
   %7D)

Remove loaded variable in feed template