race condiiton on node schema loading solved

This commit is contained in:
Lucio Lelii 2026-04-10 09:26:31 +02:00
parent 62793635b7
commit f57f5be073
3 changed files with 23 additions and 2 deletions

View File

@ -23,13 +23,15 @@ export class BlocksService {
readonly catalogLoading = this._catalogLoading.asReadonly();
hasLoadedBlockTypes() {
return this._blockTypes().length > 0 || !this.toInit;
return this._blockTypes().length > 0 || (!this.toInit && !this.loadingPromise);
}
async getAllBlocksTypes() {
if (this.toInit) {
this.toInit = false;
await this.refresh();
} else if (this.loadingPromise) {
await this.loadingPromise;
}
return this._blockTypes.asReadonly();
@ -65,6 +67,11 @@ export class BlocksService {
const current = this._blockTypes().find((blockType) => blockType.type === typeName);
if (current) return current;
if (this.loadingPromise) {
await this.loadingPromise;
return this._blockTypes().find((blockType) => blockType.type === typeName);
}
this._catalogLoading.set(true);
const blockTypes = await firstValueFrom(this.blocksCallService.retrieveAllBlocksTypes())
.finally(() => {

View File

@ -23,13 +23,15 @@ export class ContainersService {
readonly catalogLoading = this._catalogLoading.asReadonly();
hasLoadedContainerTypes() {
return this._containerTypes().length > 0 || !this.toInit;
return this._containerTypes().length > 0 || (!this.toInit && !this.loadingPromise);
}
async getAllContainerTypes() {
if (this.toInit) {
this.toInit = false;
await this.refresh();
} else if (this.loadingPromise) {
await this.loadingPromise;
}
return this._containerTypes.asReadonly();
@ -65,6 +67,11 @@ export class ContainersService {
const current = this._containerTypes().find((containerType) => containerType.type === typeName);
if (current) return current;
if (this.loadingPromise) {
await this.loadingPromise;
return this._containerTypes().find((containerType) => containerType.type === typeName);
}
this._catalogLoading.set(true);
const containerTypes = await firstValueFrom(this.containersCallService.retrieveAllContainerTypes())
.finally(() => {

View File

@ -614,6 +614,13 @@ export class GenericNodeComponent {
} finally {
this.schemaLoading = false;
this.schemaReady = true;
queueMicrotask(() => {
try {
this.cdr.detectChanges();
} catch {
// Node may have been removed while schema was loading.
}
});
}
}