race condiiton on node schema loading solved
This commit is contained in:
parent
62793635b7
commit
f57f5be073
|
|
@ -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(() => {
|
||||
|
|
|
|||
|
|
@ -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(() => {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue