diff --git a/src/app/chat/chat.html b/src/app/chat/chat.html
index b105446..7853b22 100644
--- a/src/app/chat/chat.html
+++ b/src/app/chat/chat.html
@@ -66,7 +66,7 @@
@if (router.url.startsWith("/chat/dm") || router.url.startsWith("/chat/picture")) {
- @defer (when serviceManager.chatsStatus() != LoadStatus.loading) {
+ @defer (when cache.contactsState() != LoadState.CLEAN_LOADING) {
}
} @else if (router.url.startsWith("/chat/network")) {
diff --git a/src/app/chat/contact-list/contact-list.ts b/src/app/chat/contact-list/contact-list.ts
index a927a0b..63f4df4 100644
--- a/src/app/chat/contact-list/contact-list.ts
+++ b/src/app/chat/contact-list/contact-list.ts
@@ -6,9 +6,9 @@ import {Oimg} from '../elements/oimg/oimg';
import {Router, RouterLink} from '@angular/router';
import {TranslatePipe} from '@ngx-translate/core';
import {LoadStatus, ServiceManager} from '../../service-manager';
-import { Contact, createContactWrapper } from 'chatenium-sdk-preview';
+import { Contact } from 'chatenium-sdk-preview';
import { CHATENIUM_SDK } from '../../chatenium.token';
-import { Cache, LoadState } from '../../cache';
+import { CacheService, LoadState } from '../../cache';
import { Avatar } from '../elements/avatar/avatar';
@Component({
@@ -21,7 +21,7 @@ export class ContactList implements OnInit {
SDK = inject(CHATENIUM_SDK);
idb = inject(IndexedDB);
router = inject(Router);
- cache = inject(Cache);
+ cache = inject(CacheService);
notification = inject(TuiNotificationService);
serviceManager = inject(ServiceManager);
breakpoint = inject(TUI_BREAKPOINT);
@@ -30,8 +30,12 @@ export class ContactList implements OnInit {
if (this.cache.contactsState() != LoadState.LOADED) {
try {
const contacts = (await this.idb.getAll('contacts')) as Contact[];
- this.cache.contacts.set(contacts);
- this.cache.contactsState.set(LoadState.CACHE_UPDATING);
+ if (contacts.length > 0) {
+ this.cache.contacts.set(contacts);
+ this.cache.contactsState.set(LoadState.CACHE_UPDATING);
+ } else {
+ console.log("Found no contacts in cache")
+ }
} catch (e) {
console.warn(`Contacts cache load failed: ${e}. Skipping cache load...`);
}
@@ -44,8 +48,8 @@ export class ContactList implements OnInit {
return
}
this.cache.contacts.set(data);
- this.cache.contactsState.set(LoadState.LOADED);
console.log(`Successfully fetched ${data.length} contacts`);
+ this.cache.contactsState.set(LoadState.LOADED);
} catch (e) {
console.error(e);
this.serviceManager.chatsStatus.set(LoadStatus.error);
diff --git a/src/app/session-manager.ts b/src/app/session-manager.ts
index 2b16967..71397f0 100644
--- a/src/app/session-manager.ts
+++ b/src/app/session-manager.ts
@@ -91,7 +91,6 @@ export class SessionManager {
console.log(
`Successfully rotated token pair for ID: ${userData.userId} Username: ${userData.username}. This session is now ready to be used.`,
);
- console.log(data.accessToken)
this.sessionReady.set(true);
} catch (e) {
console.error(e);