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 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 );
Original file line number Diff line number Diff 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 ( ) ;
Original file line number Diff line number Diff 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 ) {
You can’t perform that action at this time.
0 commit comments