Router.configure
waitOn: ->
Meteor.subscribe 'data'
Does data
get torn down and re-subscribed to when I switch from /bar
to /foo
, or does it stay subscribed to for the entire session, like the null
publication?
Yes, data is discarded when you change routes.
There are solution out there to solve this. One such solution is provided by @arunoda. Check out this repository: subs-manager
Usage with Iron Router: just replace Meteor.subscribe() calls with subs.subscribe(), where subs is a new SubsManager().
subs = new SubsManager
Router.configure
waitOn: ->
subs.subscribe 'data'