mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
allow t.map render fn to not return a dom node
This commit is contained in:
parent
3f36ea04f4
commit
010b782a96
@ -322,7 +322,11 @@ class TemplateBuilder {
|
|||||||
map(mapFn, renderFn) {
|
map(mapFn, renderFn) {
|
||||||
return this.mapView(mapFn, mappedValue => {
|
return this.mapView(mapFn, mappedValue => {
|
||||||
return new TemplateView(this._value, (t, vm) => {
|
return new TemplateView(this._value, (t, vm) => {
|
||||||
return renderFn(mappedValue, t, vm);
|
const rootNode = renderFn(mappedValue, t, vm);
|
||||||
|
if (!rootNode) {
|
||||||
|
return document.createComment("map placeholder");
|
||||||
|
}
|
||||||
|
return rootNode;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user