Clear filter states in onDeactivated() instead of onActivated() to ber fresh on view

This commit is contained in:
Johannes Zellner
2025-09-30 10:24:58 +02:00
parent 249734f52a
commit 55cd323159
2 changed files with 8 additions and 11 deletions
+5 -8
View File
@@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n';
const i18n = useI18n();
const t = i18n.t;
import { ref, computed, useTemplateRef, onActivated, onMounted, onUnmounted, inject } from 'vue';
import { ref, computed, useTemplateRef, onActivated, onDeactivated, 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';
@@ -237,10 +237,7 @@ function toggleView() {
onActivated(async () => {
await refreshApps();
});
onMounted(async () => {
await refreshApps();
ready.value = true;
const [error, result] = await domainsModel.list();
if (error) return console.error(error);
@@ -251,12 +248,12 @@ onMounted(async () => {
stateFilter.value = stateFilterOptions[0].id;
tagFilter.value = tagFilterOptions.value[0].id;
ready.value = true;
refreshInterval = setInterval(refreshApps, 5000);
});
onUnmounted(() => {
onDeactivated(() => {
filter.value = '';
clearInterval(refreshInterval);
});
+3 -3
View File
@@ -179,9 +179,6 @@ function setItemWidth() {
}
onActivated(async () => {
search.value = '';
category.value = '';
setItemWidth();
await getAppList();
@@ -196,6 +193,9 @@ onActivated(async () => {
});
onDeactivated(() => {
search.value = '';
category.value = '';
window.removeEventListener('hashchange', onHashChange);
window.removeEventListener('resize', setItemWidth);
});