diff --git a/web-app/src/app/feed/feed-list/feed-list.component.ts b/web-app/src/app/feed/feed-list/feed-list.component.ts index 4807f22a5..4c0ff4a35 100644 --- a/web-app/src/app/feed/feed-list/feed-list.component.ts +++ b/web-app/src/app/feed/feed-list/feed-list.component.ts @@ -1,6 +1,7 @@ import { Component, Input, OnChanges, SimpleChanges } from '@angular/core'; import { Feed, FeedService } from '@ngageoint/mage.web-core-lib/feed'; import { Feature } from 'geojson'; +import { Subscription } from 'rxjs' @Component({ selector: 'feed-list', @@ -11,13 +12,15 @@ export class FeedListComponent implements OnChanges { @Input() feed: Feed items: Array = [] + feedSubscription: Subscription | null = null constructor(private feedService: FeedService) {} ngOnChanges(changes: SimpleChanges): void { const feed: Feed = changes.feed.currentValue; + this.feedSubscription?.unsubscribe() if (feed) { - this.feedService.feedItems(feed.id).subscribe(items => { + this.feedSubscription = this.feedService.feedItems(feed.id).subscribe(items => { this.items = items; }); }