Skip to content

Commit

Permalink
Fixes #14192
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
krisselden committed Sep 6, 2016
1 parent 22721f2 commit 44d8afa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
14 changes: 2 additions & 12 deletions packages/ember-htmlbars/lib/hooks/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 44d8afa

Please sign in to comment.