|
1 | | -import { acceptHMRUpdate, defineStore, storeToRefs } from "pinia"; |
2 | | -import { readonly, ref, watch } from "vue"; |
| 1 | +import { acceptHMRUpdate, defineStore } from "pinia"; |
| 2 | +import { readonly, ref } from "vue"; |
3 | 3 | import { useServiceControlStore } from "./ServiceControlStore"; |
4 | 4 | import { useCookies } from "vue3-cookies"; |
5 | 5 | import FailureGroupView from "@/resources/FailureGroupView"; |
@@ -32,14 +32,17 @@ export const useDeletedMessageGroupsStore = defineStore("DeletedMessageGroupsSto |
32 | 32 | let undismissedRestoreGroups: ExtendedFailureGroupView[] = []; |
33 | 33 |
|
34 | 34 | const serviceControlStore = useServiceControlStore(); |
35 | | - const { serviceControlUrl } = storeToRefs(serviceControlStore); |
36 | 35 | const messageGroupClient = new MessageGroupClient(serviceControlStore); |
37 | 36 |
|
38 | 37 | const cookies = useCookies(); |
39 | 38 |
|
40 | 39 | async function refresh() { |
| 40 | + if (!selectedClassifier.value) { |
| 41 | + await getGroupingClassifiers(); |
| 42 | + selectedClassifier.value = getGrouping() ?? classifiers.value[0]; |
| 43 | + } |
41 | 44 | //get all deleted message groups |
42 | | - const [, result] = await serviceControlStore.fetchTypedFromServiceControl<FailureGroupView[]>(`errors/groups/${selectedClassifier.value}`); |
| 45 | + const [, result] = await serviceControlStore.fetchTypedFromServiceControl<FailureGroupView[]>(`errors/groups/${selectedClassifier.value ?? getGrouping()}`); |
43 | 46 |
|
44 | 47 | if (result.length === 0 && undismissedRestoreGroups.length > 0) { |
45 | 48 | undismissedRestoreGroups.forEach((deletedGroup) => { |
@@ -120,18 +123,11 @@ export const useDeletedMessageGroupsStore = defineStore("DeletedMessageGroupsSto |
120 | 123 | archiveGroups.value = archiveGroups.value.filter((group) => group.id !== dismissedGroup.id); |
121 | 124 | } |
122 | 125 |
|
123 | | - async function initialise() { |
124 | | - await Promise.all([getGroupingClassifiers()]); |
125 | | - selectedClassifier.value = getGrouping() ?? classifiers.value[0]; |
126 | | - } |
127 | | - |
128 | | - watch(serviceControlUrl, initialise, { immediate: true }); |
129 | | - |
130 | 126 | return { |
131 | 127 | refresh, |
132 | 128 | classifiers: readonly(classifiers), |
133 | 129 | selectedClassifier, |
134 | | - archiveGroups: archiveGroups, |
| 130 | + archiveGroups, |
135 | 131 | getGrouping, |
136 | 132 | setGrouping, |
137 | 133 | restoreGroup, |
|
0 commit comments