[BUGFIX] Adds default implementations of Component lifecycle hooks #17169
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds default implementations for all of
Ember.Component
's lifecycle hooks. Fixes #17156.There are some notable concerns here:
_super
in a hook which did not have a default implementation. This may be worth benchmarking, but I'm unsure if it would make that much of a difference.didDestroyElement
hook was not previously documented, and may not have been considered public API. It is under test, and there are no internal usages of it besides test, so it may be a better idea to not publicly expose it and deprecate/remove it instead.The alternative would be to remove lifecycle hook defaults entirely. As long as we're consistent in telling users "always call
super
" or "never callsuper
unless its your own code" I think it would be fine. The current situation, where we sometimes-do-and-sometimes-don't, is the worst of both worlds. Removing lifecycle hooks entirely may require a deprecation.