refactor(api): optimize caching mechanisms and improve book filtering (#372)
* refactor(api): optimize caching mechanisms and improve book filtering logic * refactor(preferences): remove unused ExternalDocLinkComponent and enhance translate function typing * refactor(initializer): add Duration import for improved cache management * refactor(docker): increase MaxMetaspaceSize for improved memory management * refactor(repository): replace findAllForSummaryByIds with findAllById * refactor(cache): implement invalidateAppBooksQueries for improved cache management * refactor(AppBookService): increase default page size and optimize magic shelf book resolution * refactor(AppBookSpecification, MagicShelfBookService, TaskCancellationManager, magic-shelf-component): streamline join handling and improve memory management * refactor(AppBookService, MagicShelfBookService): enhance book retrieval logic and improve error handling * chore: fix formatting * chore: fix formatting
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {Component, computed, effect, inject, OnInit} from '@angular/core';
|
||||
import {Component, computed, effect, inject, Injector, OnInit, runInInjectionContext} from '@angular/core';
|
||||
import {AbstractControl, FormArray, FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators} from '@angular/forms';
|
||||
import {Button} from 'primeng/button';
|
||||
import {NgTemplateOutlet} from '@angular/common';
|
||||
@@ -248,6 +248,7 @@ const READ_STATUS_KEYS: Record<string, string> = {
|
||||
export class MagicShelfComponent implements OnInit {
|
||||
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly injector = inject(Injector);
|
||||
private readonly controlIds = new WeakMap<AbstractControl, string>();
|
||||
private controlIdCounter = 0;
|
||||
|
||||
@@ -514,14 +515,16 @@ export class MagicShelfComponent implements OnInit {
|
||||
|
||||
if (id) {
|
||||
this.shelfId = id;
|
||||
effect(() => {
|
||||
const shelf = this.magicShelfService.findShelfById(id);
|
||||
if (!shelf || this.formInitializedFromShelf) {
|
||||
return;
|
||||
}
|
||||
runInInjectionContext(this.injector, () => {
|
||||
effect(() => {
|
||||
const shelf = this.magicShelfService.findShelfById(id);
|
||||
if (!shelf || this.formInitializedFromShelf) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.initializeForm(shelf);
|
||||
this.formInitializedFromShelf = true;
|
||||
this.initializeForm(shelf);
|
||||
this.formInitializedFromShelf = true;
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.initializeForm();
|
||||
|
||||
Reference in New Issue
Block a user