kadirahq / flow-router

Carefully Designed Client Side Router for Meteor
MIT License
1.09k stars 195 forks source link

How to cancel render of Template when start redirect? #644

Open comerc opened 8 years ago

comerc commented 8 years ago

onRendered executed anyway:

  onCreated: ->
    route = FlowRouter.getParam('user')
    @user = findUser(route)
    FlowRouter.go('notFound') if not @user
  onRendered: ->
    $('#userName').text(@user.name)
comerc commented 8 years ago

Help me please! :)

IronRouter does not have this problem. console.log('onRendered'); does not call in this test:

Template.login.onCreated(function() {
    console.log('onCreated');
    Router.go('/restore-password');
});

Template.login.onRendered(function() {
    console.log('onRendered');
});
comerc commented 8 years ago

Oh-oh-oh, related issues: https://github.com/kadirahq/flow-router/issues/292 https://github.com/kadirahq/flow-router/issues/96