StatusBar and Sidebar views update correctly

This commit is contained in:
Geomitron
2020-02-09 23:49:23 -05:00
parent de39ad4f1e
commit 1e16371958
6 changed files with 63 additions and 16 deletions

View File

@@ -1,7 +1,6 @@
import { Component, ChangeDetectorRef } from '@angular/core'
import { Download } from '../../../../../electron/shared/interfaces/download.interface'
import { DownloadService } from '../../../../core/services/download.service'
import * as _ from 'underscore'
@Component({
selector: 'app-downloads-modal',
@@ -12,8 +11,7 @@ export class DownloadsModalComponent {
downloads: Download[] = []
constructor(downloadService: DownloadService, private ref: ChangeDetectorRef) {
const detectChanges = _.throttle(() => this.ref.detectChanges(), 30)
constructor(downloadService: DownloadService, ref: ChangeDetectorRef) {
downloadService.onDownloadUpdated(download => {
const index = this.downloads.findIndex(thisDownload => thisDownload.versionID == download.versionID)
if (index == -1) {
@@ -21,7 +19,7 @@ export class DownloadsModalComponent {
} else {
this.downloads[index] = download
}
detectChanges()
ref.detectChanges()
})
}