When I am already logged in and I refresh the following code redirects me

If the user does not close his session and comes backs later, it is redirected but he should not be redirected because he is already logged in.
Why is that and how can I avoid it?

triggersEnter: [function(context, redirect) {
  if (!Meteor.loggingIn() && !Meteor.userId()) {
    redirect('/');
  }
}]

Meteor.loggingIn() will return true at this point. If you install the staringatlights:fast-render and remove the Meteor.loggingIn() you should be all set.

Thanks for the reply, one question.
It looks there are several fast-render packages.
I have tried one and it did not work. Is there one that is npm instead of atmosphere?
It would not make sense since it is specific to meteor, right?

The most up to date and maintained fast-render package is the one by staringatlights on atmosphere. I don’t believe you’ll find anything suitable on npm due to how the package integrates with Meteor.

I’m not sure why this would not work. I use fast-render extensively for this specific purpose and it works fantastic. If you have a repo that I can clone, I’d be more than willing to dive into this and try to figure it out.

1 Like