Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iron router hooks run multiple times for routes that are protected by ensureSignedIn #262

Closed
bumbleblym opened this issue Jan 30, 2015 · 5 comments

Comments

@bumbleblym
Copy link
Contributor

The onBeforeAction and onAfterAction hooks run twice when logged out, and thrice when logged in.

Here's a reproduction repo.

@bumbleblym
Copy link
Contributor Author

My mistake, the hooks run only once when logged in. Still, are they supposed to run twice when logged out? This occurs when navigating to the page while logged out.

@splendido
Copy link
Member

I've cloned the repo and gave it a quick try.

I think the only reactive var within ensureSignedIn is the Meteor.user(), see this line.
...which should be better changed to Meteor.userId()

I'll try to investigate more asap...

@splendido
Copy link
Member

The source or reactivity was Router.current() :(

Btw, good catch!
Tnx!!

@bumbleblym
Copy link
Contributor Author

Thanks for the prompt fix! 👍

@splendido
Copy link
Member

It was an easy one ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants