Search code examples
meteoriron-router

How do I reload the current iron:router route?


If I'm currently at /foo, Router.go '/foo' does nothing. I would like /foo's action hooks and rendering to be redone. I know I could make a dependency, mention it in an action hook, and invalidate it when I need to reload, I'm just hoping there's a Router.* api I can use, because that would be cleaner.


Solution

  • This adds a function Router.rerun() that works:

    login_dep = new Tracker.Dependency
    
    Router.rerun = ->
      login_dep.changed()
    
    Router.configure
      onBeforeAction: ->
        login_dep.depend()
        ...