Skip to content

Commit f68b211

Browse files
authored
Fix/control panel refresh (#327)
* fix: evoting groups * chore: fix evault uris * chore: fix evault visibility
1 parent c196fd6 commit f68b211

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

infrastructure/control-panel/src/lib/components/EVaultList.svelte

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,27 @@
99
let cacheStatus: { lastUpdated: number; isStale: boolean; itemCount: number };
1010
1111
onMount(async () => {
12+
console.log('Component mounted, starting to load eVaults...');
1213
try {
14+
loading = true;
15+
console.log('Loading state set to true');
1316
await loadEVaults();
1417
cacheStatus = EVaultService.getCacheStatus();
18+
console.log('Loaded eVaults:', evaults.length, 'items');
1519
} catch (err) {
1620
error = 'Failed to load eVaults';
17-
console.error(err);
21+
console.error('Error in onMount:', err);
1822
} finally {
1923
loading = false;
24+
console.log('Loading state set to false');
2025
}
2126
});
2227
2328
async function loadEVaults() {
29+
console.log('loadEVaults called');
2430
try {
2531
evaults = await EVaultService.getEVaults();
32+
console.log('EVaultService returned:', evaults.length, 'items');
2633
cacheStatus = EVaultService.getCacheStatus();
2734
} catch (err) {
2835
console.error('Error loading eVaults:', err);

infrastructure/control-panel/src/lib/services/cacheService.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ class CacheService {
5353

5454
async getCachedEVaults(): Promise<EVault[]> {
5555
if (typeof window !== 'undefined') {
56-
// In browser, return empty array - caching only works on server
57-
return [];
56+
// In browser, return null to indicate we need to fetch from server
57+
// This prevents showing "No eVaults found" prematurely
58+
return null as any;
5859
}
5960

6061
await this.init();

infrastructure/control-panel/src/lib/services/evaultService.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ export class EVaultService {
77
* Returns cached data immediately, refreshes in background if stale
88
*/
99
static async getEVaults(): Promise<EVault[]> {
10-
// Check if cache is stale
10+
// In browser, always fetch from server since caching doesn't work here
11+
if (typeof window !== 'undefined') {
12+
return this.fetchEVaultsDirectly();
13+
}
14+
15+
// On server, use caching
1116
const isStale = await cacheService.isCacheStale();
1217

1318
if (isStale) {

0 commit comments

Comments
 (0)