fix(user-settings): fix settings loading errors (#527)

* refactor(user): optimize detail fetching with custom repository implementation

* refactor(fonts): fix font loading and improve custom font handling

* refactor(user-data): update userSettings to use input() for better reactivity

* refactor(fonts): improve font loading logic and improve readi ness state management again

* refactor(user-data): simplify user fetching logic and improve batch loading

* refactor(custom-fonts): improve font loading logic with run ID for better state management
This commit is contained in:
brios
2026-04-22 17:27:35 -04:00
committed by Zach Yale
parent 5bd2e9ad3f
commit 902f5f5d67
7 changed files with 192 additions and 146 deletions
@@ -24,8 +24,6 @@ import {DatePipe} from '@angular/common';
providers: [ConfirmationService, DialogService]
})
export class CustomFontsComponent implements OnInit {
customFonts: CustomFont[] = [];
isLoading = true;
fontsLoadedInBrowser = false;
uploadDialogRef: DynamicDialogRef | null = null;
@@ -38,6 +36,9 @@ export class CustomFontsComponent implements OnInit {
private t = inject(TranslocoService);
private destroyRef = inject(DestroyRef);
get customFonts(): CustomFont[] { return this.customFontService.fonts(); }
get isLoading(): boolean { return this.customFontService.isFontsLoading(); }
ngOnInit(): void {
this.loadFonts();
}
@@ -48,9 +49,6 @@ export class CustomFontsComponent implements OnInit {
try {
const fonts = await this.customFontService.ensureFonts();
this.customFonts = fonts;
this.isLoading = false;
await this.customFontService.loadAllFonts(fonts);
this.fontsLoadedInBrowser = true;
@@ -61,7 +59,6 @@ export class CustomFontsComponent implements OnInit {
summary: this.t.translate('common.error'),
detail: this.t.translate('settingsReader.fonts.loadError')
});
this.isLoading = false;
this.fontsLoadedInBrowser = true;
}
}
@@ -87,10 +84,7 @@ export class CustomFontsComponent implements OnInit {
if (this.uploadDialogRef) {
this.uploadDialogRef.onClose.pipe(
takeUntilDestroyed(this.destroyRef)
).subscribe((font: CustomFont | null) => {
if (font) {
this.customFonts.push(font);
}
).subscribe(() => {
this.uploadDialogRef = null;
});
}
@@ -106,7 +100,6 @@ export class CustomFontsComponent implements OnInit {
takeUntilDestroyed(this.destroyRef)
).subscribe({
next: () => {
this.customFonts = this.customFonts.filter(f => f.id !== font.id);
this.messageService.add({
severity: 'success',
summary: this.t.translate('common.success'),