From 453cde406e0426763fa7bd5428b12e1bad1bdbde Mon Sep 17 00:00:00 2001 From: mchouliara Date: Tue, 24 Sep 2024 10:41:38 +0300 Subject: [PATCH] small fix plan-editor --- .../plan-editor.component.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.component.ts b/frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.component.ts index 6959e9f2e..53438a18d 100644 --- a/frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.component.ts +++ b/frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.component.ts @@ -210,14 +210,17 @@ export class PlanEditorComponent extends BaseEditor imple super.ngOnInit(); if (this.isNew === false && this.step === 0) this.nextStep(); - this.formAnnotationService.init(this.item.id, AnnotationEntityType.Plan); - this.formAnnotationService.getAnnotationCountObservable().pipe(takeUntil(this._destroyed)).subscribe((annotationsPerAnchor: Map) => { - this.annotationsPerAnchor = annotationsPerAnchor; - }); - this.formAnnotationService.getOpenAnnotationSubjectObservable().pipe(takeUntil(this._destroyed)).subscribe((anchorId: string) => { - if (anchorId && anchorId == this.item.id?.toString()) this.showAnnotations(anchorId); - }); + if(this.item?.id){ + this.formAnnotationService.init(this.item.id, AnnotationEntityType.Plan); + this.formAnnotationService.getAnnotationCountObservable().pipe(takeUntil(this._destroyed)).subscribe((annotationsPerAnchor: Map) => { + this.annotationsPerAnchor = annotationsPerAnchor; + }); + + this.formAnnotationService.getOpenAnnotationSubjectObservable().pipe(takeUntil(this._destroyed)).subscribe((anchorId: string) => { + if (anchorId && anchorId == this.item.id?.toString()) this.showAnnotations(anchorId); + }); + } } ngAfterViewInit(): void {