The easiest solution that comes to my mind is to implement a custom helper:
UI.registerHelper('safeRender', function () {
var component = Template[this.name];
if (component) {
return component.extend({data: this.data});
}
return UI.Component;
});
which you can use in your templates like this:
{{> safeRender name='customHeaders' data=.}}
The data=.
part is there to ensure that the template will be rendered in the same data context.