From c85b2ca3c9a415bf2697f86ff4955a3ec31b6abb Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 15 Apr 2021 15:11:05 +0200 Subject: [PATCH] allow manually updating subviews in templates w/ parentProvidesUpdates --- src/platform/web/ui/general/TemplateView.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/platform/web/ui/general/TemplateView.js b/src/platform/web/ui/general/TemplateView.js index 8b0da9df..f72e3383 100644 --- a/src/platform/web/ui/general/TemplateView.js +++ b/src/platform/web/ui/general/TemplateView.js @@ -131,6 +131,14 @@ export class TemplateView extends BaseUpdateView { this._subViews.splice(idx, 1); } } + + updateSubViews(value, props) { + if (this._subViews) { + for (const v of this._subViews) { + v.update(value, props); + } + } + } } // what is passed to render @@ -260,10 +268,10 @@ class TemplateBuilder { // this insert a view, and is not a view factory for `if`, so returns the root element to insert in the template // you should not call t.view() and not use the result (e.g. attach the result to the template DOM tree). - view(view) { + view(view, mountOptions = undefined) { let root; try { - root = view.mount(); + root = view.mount(mountOptions); } catch (err) { return errorToDOM(err); }