From 71f9c2c0df34faf3e3605c3c7ce9e534531a737c Mon Sep 17 00:00:00 2001 From: Godfrey Chan Date: Tue, 6 Sep 2016 23:35:12 -0700 Subject: [PATCH] Always fire component hooks when subtree updates This correctly implements the semantics in https://github.com/emberjs/ember.js/issues/13947 Requires the corresponding Glimmer change --- packages/ember-glimmer/lib/environment.js | 5 ---- .../integration/components/life-cycle-test.js | 23 +++++++++++++++++-- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/packages/ember-glimmer/lib/environment.js b/packages/ember-glimmer/lib/environment.js index b02b5695182..aa3a716a916 100644 --- a/packages/ember-glimmer/lib/environment.js +++ b/packages/ember-glimmer/lib/environment.js @@ -338,11 +338,6 @@ export default class Environment extends GlimmerEnvironment { return createIterable(ref, keyPath); } - didCreate(component, manager) { - this.createdComponents.unshift(component); - this.createdManagers.unshift(manager); - } - didDestroy(destroyable) { destroyable.destroy(); } diff --git a/packages/ember-glimmer/tests/integration/components/life-cycle-test.js b/packages/ember-glimmer/tests/integration/components/life-cycle-test.js index 5174e80a8d5..af19b27b264 100644 --- a/packages/ember-glimmer/tests/integration/components/life-cycle-test.js +++ b/packages/ember-glimmer/tests/integration/components/life-cycle-test.js @@ -250,13 +250,25 @@ class LifeCycleHooksTest extends RenderingTest { // Sync hooks + ['the-top', 'willUpdate'], + ['the-top', 'willRender'], + + ['the-middle', 'willUpdate'], + ['the-middle', 'willRender'], + ['the-bottom', 'willUpdate'], ['the-bottom', 'willRender'], // Async hooks ['the-bottom', 'didUpdate'], - ['the-bottom', 'didRender'] + ['the-bottom', 'didRender'], + + ['the-middle', 'didUpdate'], + ['the-middle', 'didRender'], + + ['the-top', 'didUpdate'], + ['the-top', 'didRender'] ); @@ -271,13 +283,20 @@ class LifeCycleHooksTest extends RenderingTest { // Sync hooks + ['the-top', 'willUpdate'], + ['the-top', 'willRender'], + ['the-middle', 'willUpdate'], ['the-middle', 'willRender'], // Async hooks ['the-middle', 'didUpdate'], - ['the-middle', 'didRender'] + ['the-middle', 'didRender'], + + ['the-top', 'didUpdate'], + ['the-top', 'didRender'] + ); this.runTask(() => this.components['the-top'].rerender());