From 5aee3df7fe595c3cc60879f0cbb52217e82601b1 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 8 May 2020 09:12:33 +0200 Subject: [PATCH] fix SessionPickerItemView not updating --- src/ui/web/general/ListView.js | 9 ++++----- src/ui/web/login/SessionPickerView.js | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ui/web/general/ListView.js b/src/ui/web/general/ListView.js index 18fc524b..25b4cd07 100644 --- a/src/ui/web/general/ListView.js +++ b/src/ui/web/general/ListView.js @@ -10,10 +10,8 @@ function insertAt(parentNode, idx, childNode) { } } -const MOUNT_ARGS = {parentProvidesUpdates: true}; - export class ListView { - constructor({list, onItemClick, className}, childCreator) { + constructor({list, onItemClick, className, parentProvidesUpdates}, childCreator) { this._onItemClick = onItemClick; this._list = list; this._className = className; @@ -21,6 +19,7 @@ export class ListView { this._subscription = null; this._childCreator = childCreator; this._childInstances = null; + this._mountArgs = {parentProvidesUpdates}; this._onClick = this._onClick.bind(this); } @@ -90,7 +89,7 @@ export class ListView { for (let item of this._list) { const child = this._childCreator(item); this._childInstances.push(child); - const childDomNode = child.mount(MOUNT_ARGS); + const childDomNode = child.mount(this._mountArgs); this._root.appendChild(childDomNode); } } @@ -99,7 +98,7 @@ export class ListView { this.onBeforeListChanged(); const child = this._childCreator(value); this._childInstances.splice(idx, 0, child); - insertAt(this._root, idx, child.mount(MOUNT_ARGS)); + insertAt(this._root, idx, child.mount(this._mountArgs)); this.onListChanged(); } diff --git a/src/ui/web/login/SessionPickerView.js b/src/ui/web/login/SessionPickerView.js index d81247ac..057b6563 100644 --- a/src/ui/web/login/SessionPickerView.js +++ b/src/ui/web/login/SessionPickerView.js @@ -77,6 +77,7 @@ export class SessionPickerView extends TemplateView { vm.pick(item.value.id); } }, + parentProvidesUpdates: false, }, sessionInfo => { return new SessionPickerItemView(sessionInfo); });