File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed
infrastructure/control-panel/src/lib Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 9
9
let cacheStatus: { lastUpdated: number ; isStale: boolean ; itemCount: number };
10
10
11
11
onMount (async () => {
12
+ console .log (' Component mounted, starting to load eVaults...' );
12
13
try {
14
+ loading = true ;
15
+ console .log (' Loading state set to true' );
13
16
await loadEVaults ();
14
17
cacheStatus = EVaultService .getCacheStatus ();
18
+ console .log (' Loaded eVaults:' , evaults .length , ' items' );
15
19
} catch (err ) {
16
20
error = ' Failed to load eVaults' ;
17
- console .error (err );
21
+ console .error (' Error in onMount: ' , err );
18
22
} finally {
19
23
loading = false ;
24
+ console .log (' Loading state set to false' );
20
25
}
21
26
});
22
27
23
28
async function loadEVaults() {
29
+ console .log (' loadEVaults called' );
24
30
try {
25
31
evaults = await EVaultService .getEVaults ();
32
+ console .log (' EVaultService returned:' , evaults .length , ' items' );
26
33
cacheStatus = EVaultService .getCacheStatus ();
27
34
} catch (err ) {
28
35
console .error (' Error loading eVaults:' , err );
Original file line number Diff line number Diff line change @@ -53,8 +53,9 @@ class CacheService {
53
53
54
54
async getCachedEVaults ( ) : Promise < EVault [ ] > {
55
55
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 ;
58
59
}
59
60
60
61
await this . init ( ) ;
Original file line number Diff line number Diff line change @@ -7,7 +7,12 @@ export class EVaultService {
7
7
* Returns cached data immediately, refreshes in background if stale
8
8
*/
9
9
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
11
16
const isStale = await cacheService . isCacheStale ( ) ;
12
17
13
18
if ( isStale ) {
You can’t perform that action at this time.
0 commit comments