Skip to content

Commit

Permalink
Add takeuntildestroyed
Browse files Browse the repository at this point in the history
  • Loading branch information
HarelM committed Jun 13, 2024
1 parent 89c8e4d commit 25196ea
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component } from "@angular/core";
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
import { Store } from "@ngxs/store";
import type { LngLatLike } from "maplibre-gl";

Expand Down Expand Up @@ -40,7 +41,7 @@ export class TracesComponent extends BaseMapComponent {
type: "FeatureCollection",
features: []
};
this.store.select((state: ApplicationState) => state.tracesState.visibleTraceId).subscribe(async (id) => {
this.store.select((state: ApplicationState) => state.tracesState.visibleTraceId).pipe(takeUntilDestroyed()).subscribe(async (id) => {
if (id == null)
{
this.clearTraceSource();
Expand Down Expand Up @@ -86,7 +87,7 @@ export class TracesComponent extends BaseMapComponent {

this.selectedTraceStart = traceCoordinates[0];
});
this.store.select((state: ApplicationState) => state.tracesState.missingParts).subscribe(m => {
this.store.select((state: ApplicationState) => state.tracesState.missingParts).pipe(takeUntilDestroyed()).subscribe(m => {
if (m != null) {
this.missingParts = structuredClone(m) as GeoJSON.FeatureCollection<GeoJSON.LineString>;
} else {
Expand Down

0 comments on commit 25196ea

Please sign in to comment.