Keep both apps and appstore views alive in vue to avoid frequent reloading

This commit is contained in:
Johannes Zellner
2025-09-29 20:17:32 +02:00
parent e05fef18a0
commit 5c6ceb2307
3 changed files with 15 additions and 5 deletions
+5 -3
View File
@@ -354,10 +354,12 @@ onMounted(async () => {
<Headerbar :config="config" :subscription="subscription"/>
<div style="display: flex; justify-content: center; overflow: auto; flex-grow: 1; padding: 0; margin: 0 10px; position: relative;">
<AppsView v-if="view === VIEWS.APPS" />
<AppConfigureView v-else-if="view === VIEWS.APP" />
<KeepAlive>
<AppsView v-if="view === VIEWS.APPS" />
<AppstoreView v-else-if="view === VIEWS.APPSTORE" />
</KeepAlive>
<AppConfigureView v-if="view === VIEWS.APP" />
<AppearanceView v-else-if="view === VIEWS.APPEARANCE" />
<AppstoreView v-else-if="view === VIEWS.APPSTORE" />
<BackupSitesView v-else-if="view === VIEWS.BACKUP_SITES" />
<BackupListView v-else-if="view === VIEWS.BACKUP_LIST" />
<BackupAppArchiveView v-else-if="view === VIEWS.BACKUP_APP_ARCHIVE" />
+5 -1
View File
@@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n';
const i18n = useI18n();
const t = i18n.t;
import { ref, computed, useTemplateRef, onMounted, onUnmounted, inject } from 'vue';
import { ref, computed, useTemplateRef, onActivated, onMounted, onUnmounted, inject } from 'vue';
import { Button, Menu, SingleSelect, Icon, TableView, TextInput, ProgressBar } from '@cloudron/pankow';
import { API_ORIGIN, APP_TYPES, HSTATES, ISTATES, RSTATES } from '../constants.js';
import AppsModel from '../models/AppsModel.js';
@@ -235,6 +235,10 @@ function toggleView() {
localStorage.appsView = viewType.value;
}
onActivated(async () => {
await refreshApps();
});
onMounted(async () => {
await refreshApps();
+5 -1
View File
@@ -5,7 +5,7 @@ const i18n = useI18n();
const t = i18n.t;
import moment from 'moment';
import { ref, computed, useTemplateRef, onMounted, onUnmounted, inject, watch, nextTick } from 'vue';
import { ref, computed, useTemplateRef, onActivated, onMounted, onUnmounted, inject, watch, nextTick } from 'vue';
import { TextInput, ProgressBar, InputDialog, SingleSelect } from '@cloudron/pankow';
import AppsModel from '../models/AppsModel.js';
import AppstoreModel from '../models/AppstoreModel.js';
@@ -178,6 +178,10 @@ function setItemWidth() {
else itemWidth.value = Number((width-gap*4)/4).toFixed() + 'px';
}
onActivated(async () => {
await getInstalledApps();
});
onMounted(async () => {
await getInstalledApps();
await getAppList();