So I’m working on a forum type app. When the user navigates to a post, the url will be
www.myapp.com/post/POSTID. I’m using Iron Router to handle the routing.
Upon entering AND leaving this post, I want to
update a collection to indicate that the user has seen the post. I know that in Iron Router, if you modify one of the underlying subscriptions that the route is subscribed to, you run into an infinite reactivity loop. I was trying to update the collection in
action() before, but got an infinite loop.
So I moved the
onRun() in the route. The infinite loop is gone, but the problem with
onRun() is that it won’t trigger on hot reload. Every time I make a code change and Meteor hot reloads, the
onRun() code is not called. I have to manually do a
ctrl-R reload of my browser to get the
onRun() code to be actually called.