]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.ts
Update angular
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-custom-markup / peertube-custom-tags / video-miniature-markup.component.ts
index cbbacf77c65d6833b14553c6a1424d97b158ced7..21774b7aadc1c05d4bb275cf4e11bee82dff824c 100644 (file)
@@ -1,5 +1,5 @@
 import { finalize } from 'rxjs/operators'
-import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'
+import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } from '@angular/core'
 import { AuthService, Notifier } from '@app/core'
 import { FindInBulkService } from '@app/shared/shared-search'
 import { Video } from '../../shared-main'
@@ -13,7 +13,8 @@ import { CustomMarkupComponent } from './shared'
 @Component({
   selector: 'my-video-miniature-markup',
   templateUrl: 'video-miniature-markup.component.html',
-  styleUrls: [ 'video-miniature-markup.component.scss' ]
+  styleUrls: [ 'video-miniature-markup.component.scss' ],
+  changeDetection: ChangeDetectionStrategy.OnPush
 })
 export class VideoMiniatureMarkupComponent implements CustomMarkupComponent, OnInit {
   @Input() uuid: string
@@ -36,7 +37,8 @@ export class VideoMiniatureMarkupComponent implements CustomMarkupComponent, OnI
   constructor (
     private auth: AuthService,
     private findInBulk: FindInBulkService,
-    private notifier: Notifier
+    private notifier: Notifier,
+    private cd: ChangeDetectorRef
   ) { }
 
   getUser () {
@@ -55,7 +57,10 @@ export class VideoMiniatureMarkupComponent implements CustomMarkupComponent, OnI
     this.findInBulk.getVideo(this.uuid)
       .pipe(finalize(() => this.loaded.emit(true)))
       .subscribe({
-        next: video => this.video = video,
+        next: video => {
+          this.video = video
+          this.cd.markForCheck()
+        },
 
         error: err => this.notifier.error($localize`Error in video miniature component: ${err.message}`)
       })