Skip to content

Commit

Permalink
fix: unlisten to errors once toolkit component is destroyed
Browse files Browse the repository at this point in the history
  • Loading branch information
QuCMGisaia committed Jan 6, 2025
1 parent 6dd2770 commit 98ad45c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions projects/arlas-toolkit/src/lib/toolkit.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { Location } from '@angular/common';
import { AfterViewInit, Component, OnInit } from '@angular/core';
import { AfterViewInit, Component, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { interval } from 'rxjs';
import { take } from 'rxjs/operators';
Expand All @@ -34,7 +34,7 @@ import { ErrorService } from './services/error/error.service';
providers: [Location],
styleUrls: ['./toolkit.component.css']
})
export class ToolkitComponent implements AfterViewInit, OnInit {
export class ToolkitComponent implements AfterViewInit, OnInit, OnDestroy {

public analytics: Array<any>;
public languages: string[];
Expand All @@ -52,7 +52,7 @@ export class ToolkitComponent implements AfterViewInit, OnInit {
private readonly errorService: ErrorService
) {
// update url when filter are set
const queryParams: Params = Object.assign({}, this.activatedRoute.snapshot.queryParams);
const queryParams: Params = {...this.activatedRoute.snapshot.queryParams};
if (!this.arlasStartupService.emptyMode) {
this.collaborativeService.collaborationBus.subscribe(collaborationEvent => {
queryParams['filter'] = this.collaborativeService.urlBuilder().split('filter=')[1];
Expand Down Expand Up @@ -133,6 +133,10 @@ export class ToolkitComponent implements AfterViewInit, OnInit {
this.walkthroughService.load();
}

public ngOnDestroy(): void {
this.errorService.unlistenToArlasCollaborativeErrors();
}

public openAnalytics(event) {
this.target = 'analytics-panel-' + event;
this.analyticsOpen = true;
Expand Down

0 comments on commit 98ad45c

Please sign in to comment.