Minor changes

This commit is contained in:
Noel Maróti
2026-11-29 11:50:17 +01:00
parent c18a8c14ca
commit 34752b446c
3 changed files with 11 additions and 8 deletions

View File

@@ -66,7 +66,7 @@
<div id="content_tint">
@if (router.url.startsWith("/chat/dm") || router.url.startsWith("/chat/picture")) {
<!-- To ensure data is loaded -->
@defer (when serviceManager.chatsStatus() != LoadStatus.loading) {
@defer (when cache.contactsState() != LoadState.CLEAN_LOADING) {
<router-outlet />
}
} @else if (router.url.startsWith("/chat/network")) {

View File

@@ -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[];
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);

View File

@@ -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);