fix SessionPickerItemView not updating

This commit is contained in:
Bruno Windels 2020-05-08 09:12:33 +02:00
parent 58e2cca375
commit 5aee3df7fe
2 changed files with 5 additions and 5 deletions

View file

@ -10,10 +10,8 @@ function insertAt(parentNode, idx, childNode) {
} }
} }
const MOUNT_ARGS = {parentProvidesUpdates: true};
export class ListView { export class ListView {
constructor({list, onItemClick, className}, childCreator) { constructor({list, onItemClick, className, parentProvidesUpdates}, childCreator) {
this._onItemClick = onItemClick; this._onItemClick = onItemClick;
this._list = list; this._list = list;
this._className = className; this._className = className;
@ -21,6 +19,7 @@ export class ListView {
this._subscription = null; this._subscription = null;
this._childCreator = childCreator; this._childCreator = childCreator;
this._childInstances = null; this._childInstances = null;
this._mountArgs = {parentProvidesUpdates};
this._onClick = this._onClick.bind(this); this._onClick = this._onClick.bind(this);
} }
@ -90,7 +89,7 @@ export class ListView {
for (let item of this._list) { for (let item of this._list) {
const child = this._childCreator(item); const child = this._childCreator(item);
this._childInstances.push(child); this._childInstances.push(child);
const childDomNode = child.mount(MOUNT_ARGS); const childDomNode = child.mount(this._mountArgs);
this._root.appendChild(childDomNode); this._root.appendChild(childDomNode);
} }
} }
@ -99,7 +98,7 @@ export class ListView {
this.onBeforeListChanged(); this.onBeforeListChanged();
const child = this._childCreator(value); const child = this._childCreator(value);
this._childInstances.splice(idx, 0, child); this._childInstances.splice(idx, 0, child);
insertAt(this._root, idx, child.mount(MOUNT_ARGS)); insertAt(this._root, idx, child.mount(this._mountArgs));
this.onListChanged(); this.onListChanged();
} }

View file

@ -77,6 +77,7 @@ export class SessionPickerView extends TemplateView {
vm.pick(item.value.id); vm.pick(item.value.id);
} }
}, },
parentProvidesUpdates: false,
}, sessionInfo => { }, sessionInfo => {
return new SessionPickerItemView(sessionInfo); return new SessionPickerItemView(sessionInfo);
}); });