-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 method is called before model method of application route #15495
Comments
init
is called before model
method of application
route - ember 2.14
As ember twiddle doesn't support newer versions of ember, created a demo app. Below are the screenshots and links for the same. For 2.13.3: https://github.com/mani-mishra/ember-15495-demo/tree/2.13.3 For 2.14.0: https://github.com/mani-mishra/ember-15495-demo/tree/2.14.0 |
I am not 100% sure without more details or a reproduction, but I believe that this is due to the change I made in #15178 (I tried to ensure that PR description explains the rationale for the change). In general, there has never been a guarantee that controllers would be created in any specific order related to the route structure. That PR was definitely fixing a number of bugs and edge cases with the prior behaviors, but its also one of those situations where a good fix happened to accidentally break a subtle behavior your app was relying on and I apologize for that. Sadly, I believe that you will need to refactor your logic in this case. |
As commented before and in the PR text, this won't be fixed for the reasons there specified. I am afraid this is one of the rare cases where we cannot fix all the edge cases. We can offer some support through Slack to help through this refactor. If you are not there yet, you can use the Slackin app to sign in. Thank you and we are sorry. |
@rwjblue and @Serabe, for fixing the above I was doing the same changes in our app and the potential fix is following the below assumption. Application's route model hook will finish before any individual route's lifecycle(except I didn't find any documentation for such, so please correct me if the above assumption is wrong. |
Issue on Ember 2.14
So our app is breaking on upgrading to 2.14, as the
init
method of controller for a particular route is executed before themodel
method ofapplication
route.We have bunch of features/flags check in
init
methods, and all those are being set in application model.This is working as expected (
model
=>afterModel
=>init
of controller of the route being loaded) till ember 2.13.3The text was updated successfully, but these errors were encountered: