Delay getting data from collection


#1

I have (jade):

each category
  .item #{name}

and (coffee):

T.helpers
  category: ->
    Meteor.setTimeout (->
	Categories.find()
      ),500

Which should basically delay retrieval of Categories’ data by 500ms.
The prob is: meteor docs say that Meteor.setTimeout *Returns a handle (*which is not essentially a cursor…) that can be used by Meteor.clearTimeout. Thus producing {{#each}} currently only accepts arrays, cursors or falsey values. error in client console.
So how can I accomplish this trivial task?


#2

What do you want to do exactly ?


#3

I am having a related issue, MONGO doc with array - Having issues with Sort ASC vs DESC sort - "falsey" error any help pls?


#4

It’s obvious that my code was incorrect. A year ago I had very little understanding of setTimeout - essentially it can’t be used in each block. I don’t remember how I resolved that one exactly, but if you need to delay showing some data - just hide it temporarily with a class and remove that class when needed :slight_smile: