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

Controller's init hook called on query param resolution #15534

Closed
Dhaulagiri opened this issue Jul 20, 2017 · 3 comments
Closed

Controller's init hook called on query param resolution #15534

Dhaulagiri opened this issue Jul 20, 2017 · 3 comments

Comments

@Dhaulagiri
Copy link
Contributor

Similar to this issue, the changes to refactor routes to lookup controllers for query params made here is causing an issue in our app I'm not sure how to remediate.

The problem is that we have a link-to to a route with query params and the route in question has a controller with an init hook that runs some setup for that controller. Prior to 2.14 this hook was only run when on the route in question, but after 2.14 this hook is run as part of the query param resolution where this route is linked to, causing unintended side effects.

Is this something we need to figure out a way to refactor around or is there something else we can do here?

@Dhaulagiri
Copy link
Contributor Author

It seems like I can work around this by moving the sensitive code to the route's setupController hook, avoiding any issues with the controller's init being called unexpectedly.

@kumkanillam
Copy link
Contributor

kumkanillam commented Jul 21, 2017

@Dhaulagiri Fine. Be aware that every time model hook is called, then setupController hook also will be called. but in case of init it will be called only once.

@Dhaulagiri
Copy link
Contributor Author

I think that is ok in our case, thanks @kumkanillam for the reminder.

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