From 44d8afa6f05beaa1d240f84a6d2a80a98d74a2db Mon Sep 17 00:00:00 2001 From: Kris Selden Date: Tue, 6 Sep 2016 13:06:11 -0700 Subject: [PATCH] Fixes #14192 Ensure rerender in ComponentNodeManager passes meta the same way as it does in render. Remove invalid fix to above issue that caused moduleName to be incorrectly mutated. --- packages/ember-htmlbars/lib/hooks/component.js | 14 ++------------ .../lib/node-managers/component-node-manager.js | 3 ++- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/packages/ember-htmlbars/lib/hooks/component.js b/packages/ember-htmlbars/lib/hooks/component.js index b9106337acc..c46fb952250 100644 --- a/packages/ember-htmlbars/lib/hooks/component.js +++ b/packages/ember-htmlbars/lib/hooks/component.js @@ -53,26 +53,16 @@ export default function componentHook(renderNode, env, scope, _tagName, params, // Determine if this is an initial render or a re-render. if (state.manager) { let sm = state.manager; - let templateMeta = null; - if (sm.block) { - templateMeta = sm.block.template.meta; - } else if (sm.scope && sm.scope._view && sm.scope._view.template) { - templateMeta = sm.scope._view.template.meta; - } - env.meta.moduleName = (templateMeta && templateMeta.moduleName) || (env.meta && env.meta.moduleName); extractPositionalParams(renderNode, sm.component.constructor, params, attrs, false); state.manager.rerender(env, attrs, visitor); return; } let parentView = env.view; - let options = { }; + let moduleName = env.meta && env.meta.moduleName; - if (moduleName) { - options.source = `template:${moduleName}`; - } + let options = { source: moduleName && `template:${moduleName}` }; let { component, layout } = lookupComponent(env.owner, tagName, options); - assert(`HTMLBars error: Could not find component named "${tagName}" (no component or template with that name was found)`, !!(component || layout)); let manager = ComponentNodeManager.create(renderNode, env, { diff --git a/packages/ember-htmlbars/lib/node-managers/component-node-manager.js b/packages/ember-htmlbars/lib/node-managers/component-node-manager.js index 592427f9a59..f3a29c7f33b 100644 --- a/packages/ember-htmlbars/lib/node-managers/component-node-manager.js +++ b/packages/ember-htmlbars/lib/node-managers/component-node-manager.js @@ -121,7 +121,8 @@ ComponentNodeManager.prototype.rerender = function ComponentNodeManager_rerender let component = this.component; return instrument(component, function ComponentNodeManager_rerender_instrument() { - let env = _env.childWithView(component); + let meta = this.block && this.block.template.meta; + let env = _env.childWithView(component, meta); let snapshot = takeSnapshot(attrs);