@@ -11,6 +11,7 @@ import { onBeforeMount, onUnmounted, ref, watch } from "vue";
11
11
import RefreshConfig from " ../RefreshConfig.vue" ;
12
12
import useAutoRefresh from " @/composables/autoRefresh.ts" ;
13
13
import throttle from " lodash/throttle" ;
14
+ import LoadingSpinner from " @/components/LoadingSpinner.vue" ;
14
15
15
16
const store = useAuditStore ();
16
17
const { messages, totalCount, sortBy, messageFilterString, selectedEndpointName, itemsPerPage, dateRange } = storeToRefs (store );
@@ -87,16 +88,16 @@ function navigateToMessage(message: Message) {
87
88
});
88
89
}
89
90
90
- let firstLoad = true ;
91
+ const firstLoad = ref ( true ) ;
91
92
92
93
onBeforeMount (() => {
93
94
setQuery ();
94
95
95
96
// without setTimeout, this happens before the store is properly initialised, and therefore the query route values aren't applied to the refresh
96
- // TODO: is there a better way to achieve this?
97
- setTimeout ( async () => await Promise .all ([dataRetriever .executeAndResetTimer (), store .loadEndpoints ()]), 0 );
98
-
99
- firstLoad = false ;
97
+ setTimeout ( async () => {
98
+ await Promise .all ([dataRetriever .executeAndResetTimer (), store .loadEndpoints ()]);
99
+ firstLoad . value = false ;
100
+ }, 0 ) ;
100
101
});
101
102
102
103
watch (
@@ -109,7 +110,7 @@ watch(
109
110
);
110
111
111
112
const watchHandle = watch ([() => route .query , itemsPerPage , sortBy , messageFilterString , selectedEndpointName , dateRange ], async () => {
112
- if (firstLoad ) {
113
+ if (firstLoad . value ) {
113
114
return ;
114
115
}
115
116
@@ -164,6 +165,7 @@ watch(autoRefreshValue, (newValue) => dataRetriever.updateTimeout(newValue));
164
165
</div >
165
166
</div >
166
167
<div class =" row results-table" >
168
+ <LoadingSpinner v-if =" firstLoad" />
167
169
<template v-for =" message in messages " :key =" message .id " >
168
170
<div class =" item" @click =" navigateToMessage(message)" >
169
171
<div class =" status" >
0 commit comments