diff --git a/src/app.js b/src/app.js index e1960e56..ae9de431 100644 --- a/src/app.js +++ b/src/app.js @@ -125,7 +125,7 @@ class DPanelApp extends LitElement { this.router.addAfterHook(() => store.updateState({ appContext: { menuVisible: false }})) // Clear some contexts on route change - this.router.addBeforeHook(() => store.clearContext(['pupContext'])); + this.router.addBeforeHook(() => store.clearContext(['pupContext, guiContext'])); if (isUnauthedRoute()) { setTimeout(() => { this.ready = true; }, 1500) diff --git a/src/pages/page-iframe/index.js b/src/pages/page-iframe/index.js index a1549fd6..c2a176e5 100644 --- a/src/pages/page-iframe/index.js +++ b/src/pages/page-iframe/index.js @@ -27,15 +27,6 @@ class IframeView extends LitElement { } `; - // Whenever pupContext source is available, set ready to true. - updated(changedProperties) { - super.updated(changedProperties); - if (changedProperties.has('pupContext')) { - this.ready = !!this.context.store.pupContext.manifest.gui.source; - this.requestUpdate(); - } - } - constructor() { super(); @@ -43,7 +34,7 @@ class IframeView extends LitElement { this.context = new StoreSubscriber(this, store) // Ready state is dependent on the pupContext having an iframe source. - this.ready = !!this.context.store.pupContext.manifest.gui.source + this.ready = !!this.context?.store?.guiContext?.ready; this.iframeElement = null; this.debouncedHandleResize = debounce(this.handleResize, 300); @@ -59,7 +50,7 @@ class IframeView extends LitElement { connectedCallback() { super.connectedCallback(); this.updateComplete.then(() => { - if (!this.ready) return + if (!this.context?.store?.guiContext?.ready) return this.iframeElement = this.shadowRoot.querySelector('iframe'); @@ -114,8 +105,8 @@ class IframeView extends LitElement { } render() { - const { pupContext } = this.context.store - if (!this.ready) { + const { guiContext } = this.context.store; + if (!guiContext.ready) { return html`