From c8dae934e8ea0f03fe9f9f865da84f8779b547f0 Mon Sep 17 00:00:00 2001 From: Xiao Gui <xgui3783@gmail.com> Date: Mon, 26 Jul 2021 09:01:59 +0200 Subject: [PATCH] bugfix: ieeg not unloaded on component destroy --- .../bsFeatures/ieeg/ieegCmp/ieeg.component.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/ieegCmp/ieeg.component.ts b/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/ieegCmp/ieeg.component.ts index 8bb282c6f..3b9d0da7c 100644 --- a/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/ieegCmp/ieeg.component.ts +++ b/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/ieegCmp/ieeg.component.ts @@ -33,7 +33,6 @@ export class BsFeatureIEEGCmp extends BsRegionInputBase implements OnDestroy{ this.subs.push( this.results$.subscribe(results => { this.results = results - console.log(this.results[0]) this.loadLandmarks() }) ) @@ -57,6 +56,7 @@ export class BsFeatureIEEGCmp extends BsRegionInputBase implements OnDestroy{ private subs: Subscription[] = [] ngOnDestroy(){ + this.unloadLandmarks() while(this.subs.length) this.subs.pop().unsubscribe() } private openElectrodeIdSet = new Set<string>() @@ -76,18 +76,22 @@ export class BsFeatureIEEGCmp extends BsRegionInputBase implements OnDestroy{ color: [number, number, number] showInSliceView: boolean }[] = [] - loadLandmarks(){ - + + private unloadLandmarks(){ /** * unload all the landmarks first */ - this.store.dispatch( + this.store.dispatch( viewreStateRemoveUserLandmarks({ payload: { landmarkIds: this.loadedLms.map(l => l['@id']) } }) ) + } + + private loadLandmarks(){ + this.unloadLandmarks() this.loadedLms = [] const lms = [] as { -- GitLab