Prevent creation of empty entry in _connectorCache for raw templates. (#4296)

This commit is contained in:
acshi 2016-06-29 10:59:48 -04:00 committed by Robin Ward
parent e4074f75b1
commit deda9a6908
1 changed files with 2 additions and 2 deletions

View File

@ -86,13 +86,12 @@ function buildConnectorCache() {
}); });
findOutlets(Ember.TEMPLATES, function(outletName, resource, uniqueName) { findOutlets(Ember.TEMPLATES, function(outletName, resource, uniqueName) {
_connectorCache[outletName] = _connectorCache[outletName] || [];
const mixin = {templateName: resource.replace('javascripts/', '')}; const mixin = {templateName: resource.replace('javascripts/', '')};
let viewClass = uniqueViews[uniqueName]; let viewClass = uniqueViews[uniqueName];
if (viewClass) { if (viewClass) {
// We are going to add it back with the proper template // We are going to add it back with the proper template
_connectorCache[outletName] = _connectorCache[outletName] || [];
_connectorCache[outletName].removeObject(viewClass); _connectorCache[outletName].removeObject(viewClass);
} else { } else {
if (!/\.raw$/.test(uniqueName)) { if (!/\.raw$/.test(uniqueName)) {
@ -101,6 +100,7 @@ function buildConnectorCache() {
} }
if (viewClass) { if (viewClass) {
_connectorCache[outletName] = _connectorCache[outletName] || [];
_connectorCache[outletName].pushObject(viewClass.extend(mixin)); _connectorCache[outletName].pushObject(viewClass.extend(mixin));
} else { } else {
// we have a raw template // we have a raw template