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

Add deprecation about modifying properties inside the didInsertElement hook to the deprecations guide #12290

Closed
courthead opened this issue Sep 4, 2015 · 5 comments

Comments

@courthead
Copy link

Issue #11493 mentioned that the following deprecation is not mentioned in the deprecations guide:

DEPRECATION: A property of <Ember.OutletView:ember1021> was modified inside the didInsertElement hook. You should never change properties on components, services or models during didInsertElement because it causes significant performance degradation.

I'd just like to request that someone who's knowledgeable about the reasons behind this deprecation add it to the guide (or at least, in the meantime, explain it below).

@rwjblue
Copy link
Member

rwjblue commented Sep 4, 2015

Can you confirm that this is on the list of deprecations pending addition to the deprecations guide? The list is in a large checklist issue in the emberjs/website issues.

@ultimatemonty
Copy link

@rwjblue it is not in the deprecations to add issue. I made a comment to request it to be added here

@furkanayhan
Copy link

For handling that deprecation, I am currently using this implementation:

myMethod: function () {
  Ember.run.schedule('afterRender', this, function () {
    // some code
  }); 
}.on('init')

instead of this:

myMethod: function () {
  // some code
}.on('didInsertElement')

in some cases.

@ultimatemonty
Copy link

thanks @furkanayhan! that's the same solution I'm currently using and it definitely removes the deprecation. I'm interested to hear the reasoning behind this deprecation as well as if there are any other "officially" recommended alternatives.

@wifelette
Copy link
Member

Added to the list, thanks!

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

5 participants