kadirahq / flow-router

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

Flow FlowRouter.go doesn't execute action #467

Closed johngonzalez closed 8 years ago

johngonzalez commented 8 years ago

I'm using Flow Router and ReactLayout. My code is this:

// Login
Meteor.loginWithPassword(username, password, function (error) {
  FlowRouter.go('/home');
});

// logout
Meteor.logout(function (error) {
  ReactLayout.render(Layout, { content: <Login /> });
});

// Route
FlowRouter.route('/home', {
  action: function() {
    console.log('action'); // Some times is executed
    ReactLayout.render(Layout, { content: <main /> });
  }
});

If I make next

  1. If I make login => go to '/home' and execute action normally, then ReactLayout render <main/>
  2. So, I make logout => ReactLayout render <Login /> into <Layout \> normally.
  3. But if I again make login => FlowRouter doesn't execute action, then ReactLayout doesn't render <main/>

Thanks for excellent package. I want to understand if exists some bad in my code or is a bug.

jeffshaver commented 8 years ago

@johngonzalez just making sure, but it isn't obvious in your example if you are ever going away from the /home route. It would be strange if this series of events happened:

  1. Login
  2. Go to /home
  3. Trigger /homes action
  4. Logout (still at /home)
  5. Login
  6. Trigger /homes action even though you are already at /home

Basically, if you are at /home, I would imagine FlowRouter.go('/home') would be a noop

johngonzalez commented 8 years ago

Exactly if I am in /home FlowRouter.go doesn't execute action again.Thanks my friend.