PERF: cache information about missing view classes.
This commit is contained in:
parent
d75ea1a0ea
commit
7038d5f1c4
|
@ -1,12 +1,17 @@
|
||||||
import registerUnbound from 'discourse/helpers/register-unbound';
|
import registerUnbound from 'discourse/helpers/register-unbound';
|
||||||
|
|
||||||
|
// see: https://github.com/emberjs/ember.js/issues/12634
|
||||||
|
var missingViews = {};
|
||||||
|
|
||||||
function renderRaw(ctx, template, templateName, params) {
|
function renderRaw(ctx, template, templateName, params) {
|
||||||
params.parent = params.parent || ctx;
|
params.parent = params.parent || ctx;
|
||||||
|
|
||||||
if (!params.view) {
|
if (!params.view && !missingViews[templateName]) {
|
||||||
var viewClass = Discourse.__container__.lookupFactory('view:' + templateName);
|
var viewClass = Discourse.__container__.lookupFactory('view:' + templateName);
|
||||||
if (viewClass) {
|
if (viewClass) {
|
||||||
params.view = viewClass.create(params);
|
params.view = viewClass.create(params);
|
||||||
|
} else {
|
||||||
|
missingViews[templateName] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue