Skip to content

Commit

Permalink
Merge pull request #98 from andy-hook/fix-route-update-perf
Browse files Browse the repository at this point in the history
Fix issue with routing performance when using updateOnRouterChange
  • Loading branch information
scott-wyatt authored Jan 13, 2020
2 parents 59e1a72 + ccd56a7 commit f6b1133
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app/ng-intercom/intercom/intercom.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Inject, Injectable, PLATFORM_ID, Optional, isDevMode, Renderer2, RendererFactory2, ViewEncapsulation } from '@angular/core'
import { Router } from '@angular/router'
import { filter } from 'rxjs/operators'
import { Router, NavigationEnd } from '@angular/router'
import { DOCUMENT, isPlatformBrowser } from '@angular/common'

import { IntercomConfig } from '../shared/intercom-config'
Expand Down Expand Up @@ -36,7 +37,7 @@ export class Intercom {

// Subscribe to router changes
if (config && config.updateOnRouterChange) {
this.router.events.subscribe(event => {
this.router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe(event => {
this.update()
})
}
Expand Down

0 comments on commit f6b1133

Please sign in to comment.