chore: Cache the dashboard app on the first load (#6774)

This commit is contained in:
Pranav Raj S
2023-04-18 19:44:57 -07:00
committed by GitHub
parent c5c36af529
commit e6505fc7a4
2 changed files with 19 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="dashboard-app--container"> <div v-if="hasOpenedAtleastOnce" class="dashboard-app--container">
<div <div
v-for="(configItem, index) in config" v-for="(configItem, index) in config"
:key="index" :key="index"
@@ -35,9 +35,14 @@ export default {
type: Object, type: Object,
default: () => ({}), default: () => ({}),
}, },
isVisible: {
type: Boolean,
default: false,
},
}, },
data() { data() {
return { return {
hasOpenedAtleastOnce: false,
iframeLoading: true, iframeLoading: true,
}; };
}, },
@@ -57,6 +62,13 @@ export default {
return { id, name, email }; return { id, name, email };
}, },
}, },
watch: {
isVisible() {
if (this.isVisible) {
this.hasOpenedAtleastOnce = true;
}
},
},
mounted() { mounted() {
window.onmessage = e => { window.onmessage = e => {

View File

@@ -23,7 +23,7 @@
:show-badge="false" :show-badge="false"
/> />
</woot-tabs> </woot-tabs>
<div v-if="!activeIndex" class="messages-and-sidebar"> <div v-show="!activeIndex" class="messages-and-sidebar">
<messages-view <messages-view
v-if="currentChat.id" v-if="currentChat.id"
:inbox-id="inboxId" :inbox-id="inboxId"
@@ -41,9 +41,11 @@
</div> </div>
</div> </div>
<dashboard-app-frame <dashboard-app-frame
v-else v-for="(dashboardApp, index) in dashboardApps"
:key="currentChat.id + '-' + activeIndex" v-show="activeIndex - 1 === index"
:config="dashboardApps[activeIndex - 1].content" :key="currentChat.id + '-' + dashboardApp.id"
:is-visible="activeIndex - 1 === index"
:config="dashboardApps[index].content"
:current-chat="currentChat" :current-chat="currentChat"
/> />
</div> </div>