I subscribe to a collection using iron router's waitOn functionality. This subscription is dependent on a Session variable.When the Session variable changes, the subscription should be renewed using the new value of the Session variable.
This works fine, but there's one problem: When the session variable changes, the page does a complete rerender. However, I just want the data to change.
Is it somehow possible to avoid this rerendering behavior and just resubscribe when the Session variable changes?
Thank you,
Tony
waitOn
is called within a computation and invalidating it (e.g. when a Session
variable changes) will cause your route controller to recompute everything. So basically, you should only be subscribing inside waitOn
based on data that comes from this.params
object. That's what it's designed for.
If you want another behavior and make your subscription parameters dependent on some Session variables, then it probably does not have anything to do with the router. In that case, you should probably use Deps.autorun
pattern as you described in your answer.