-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit refines the lifecycle hooks to more completely support the use-cases. On first render (in order): * `didInitAttrs` runs after `attrs` is guaranteed to be up to date. This is more reliable than trying to ensure that `attrs` are always available on `init`. * `didReceiveAttrs` runs after `didInitAttrs` (it also runs on subsequent re-renders, which is useful for logic that is the same on all renders). * `willRender` runs before the template is rendered. It runs when the template is updated for any reason (both initial and re-render, and regardless of whether the change was caused by an attrs change or re-render). * `didInsertElement` runs after the template has rendered and the element is in the DOM. * `didRender` runs after `didInsertElement` (it also runs on subsequent re-renders). On re-render (in order): * `didUpdateAttrs` runs when the attributes of a component have changed (but not when the component is re-rendered, via `component.rerender`, `component.set`, or changes in models or services used by the template). * `didReceiveAttrs`, same as above. * `willUpdate` runs when the component is re-rendering for any reason, including `component.rerender()`, `component.set()` or changes in models or services used by the template. * `willRender`, same as above * `didUpdate` runs after the template has re-rendered and the DOM is now up to date. * `didRender`, same as above. Note that a component is re-rendered whenever: 1. any of its attributes change 2. `component.set()` is called 3. `component.rerender()` is called 4. a property on a model or service used by the template has changed (including through computed properties). Because of the Glimmer engine, these re-renders are fast, and avoid unnecessary work.
- Loading branch information
1 parent
6af6fa4
commit 84c2875
Showing
7 changed files
with
262 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.