diff --git a/src/base/ViewWrapper.ts b/src/base/ViewWrapper.ts index 177e22fcb..827c3caf2 100644 --- a/src/base/ViewWrapper.ts +++ b/src/base/ViewWrapper.ts @@ -121,16 +121,19 @@ export default class ViewWrapper extends EventHandler implements IViewProvider { set visible(visible: boolean) { const selection = this.inputSelections.get(DEFAULT_SELECTION_NAME); - if (visible && this.instance == null && selection && this.match(selection)) { - //lazy init - this.createView(selection); - } + if (visible) { this.node.classList.remove('hidden'); - this.update(); } else { this.node.classList.add('hidden'); } + + if (visible && this.instance == null && selection && this.match(selection)) { + //lazy init + this.createView(selection); + } else { + this.update(); // if the view was just created we don't need to call update again + } } get visible() { @@ -339,8 +342,8 @@ export default class ViewWrapper extends EventHandler implements IViewProvider { } update() { - if (this.visible && this.instance && typeof (this.instance).update === 'function' && this.node.getBoundingClientRect().width > 0) { - (this.instance!).update(); + if (this.visible && this.instance && typeof (this.instance).forceUpdate === 'function') { + (this.instance!).forceUpdate(); } }