diff --git a/src/app/pages/home/home-page.component.ts b/src/app/pages/home/home-page.component.ts index a4fc8f2..daefa1e 100644 --- a/src/app/pages/home/home-page.component.ts +++ b/src/app/pages/home/home-page.component.ts @@ -46,7 +46,7 @@ export class HomePageComponent implements OnInit, OnDestroy { private discoveryContainerWidth: number; private discoveryContainerHeight: number; private discoveryStartDate: Date; - private discoveryRequestID: string; + private discoveryRequestID: string | null; private readonly maxScale: number; private readonly minScale: number; @@ -70,7 +70,9 @@ export class HomePageComponent implements OnInit, OnDestroy { @HostListener('window:beforeunload', ['$event']) onBeforeUnload(event) { - this.probeService.send('DiscoveryService.DiscoverStop', requesterID, this.discoveryRequestID); + if (null !== this.discoveryRequestID) { + this.probeService.send('DiscoveryService.DiscoverStop', requesterID, this.discoveryRequestID); + } // event.returnValue = true; } @@ -88,6 +90,8 @@ export class HomePageComponent implements OnInit, OnDestroy { this.hosts = []; this.ports = []; + this.discoveryRequestID = null; + this.maxScale = 1; this.minScale = 0.7; } @@ -552,7 +556,7 @@ export class HomePageComponent implements OnInit, OnDestroy { @RPCSubscriber({ method: 'DiscoveryService.QueueingTimeout' }) public DiscoveryQueueingTimeout(queueingTimeoutDate: Date) { console.log('DiscoveryQueueingTimeout', queueingTimeoutDate); - this.discoveryRequestID = ''; + this.discoveryRequestID = null; } /** @@ -571,7 +575,7 @@ export class HomePageComponent implements OnInit, OnDestroy { public DiscoveryStop(stopDate: Date) { console.log('DiscoveryStop', stopDate); - this.discoveryRequestID = ''; + this.discoveryRequestID = null; const _millisecond = Math.abs(stopDate.getTime() - this.discoveryStartDate.getTime());