diff options
author | Chocobozzz <me@florianbigard.com> | 2022-09-28 13:36:59 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-09-28 13:36:59 +0200 |
commit | b105ea604286092b4e5fd5667f2957d113278dde (patch) | |
tree | 8eb362025ae3039789c9e267cb39bb60d6d219ad /client/src/app/+videos | |
parent | 9d84ac5ec1cb0babf385392e8081717cdd2b6b66 (diff) | |
download | PeerTube-b105ea604286092b4e5fd5667f2957d113278dde.tar.gz PeerTube-b105ea604286092b4e5fd5667f2957d113278dde.tar.zst PeerTube-b105ea604286092b4e5fd5667f2957d113278dde.zip |
Correctly unsubscribe upload events on destroy
Diffstat (limited to 'client/src/app/+videos')
-rw-r--r-- | client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts index 4a100a390..19fba2a83 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts | |||
@@ -13,6 +13,7 @@ import { isIOS } from '@root-helpers/web-browser' | |||
13 | import { HttpStatusCode, VideoCreateResult } from '@shared/models' | 13 | import { HttpStatusCode, VideoCreateResult } from '@shared/models' |
14 | import { UploaderXFormData } from './uploaderx-form-data' | 14 | import { UploaderXFormData } from './uploaderx-form-data' |
15 | import { VideoSend } from './video-send' | 15 | import { VideoSend } from './video-send' |
16 | import { Subscription } from 'rxjs' | ||
16 | 17 | ||
17 | @Component({ | 18 | @Component({ |
18 | selector: 'my-video-upload', | 19 | selector: 'my-video-upload', |
@@ -56,6 +57,8 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
56 | 57 | ||
57 | private alreadyRefreshedToken = false | 58 | private alreadyRefreshedToken = false |
58 | 59 | ||
60 | private uploadServiceSubscription: Subscription | ||
61 | |||
59 | constructor ( | 62 | constructor ( |
60 | protected formValidatorService: FormValidatorService, | 63 | protected formValidatorService: FormValidatorService, |
61 | protected loadingBar: LoadingBarService, | 64 | protected loadingBar: LoadingBarService, |
@@ -87,7 +90,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
87 | this.userVideoQuotaUsedDaily = data.videoQuotaUsedDaily | 90 | this.userVideoQuotaUsedDaily = data.videoQuotaUsedDaily |
88 | }) | 91 | }) |
89 | 92 | ||
90 | this.resumableUploadService.events | 93 | this.uploadServiceSubscription = this.resumableUploadService.events |
91 | .subscribe(state => this.onUploadVideoOngoing(state)) | 94 | .subscribe(state => this.onUploadVideoOngoing(state)) |
92 | } | 95 | } |
93 | 96 | ||
@@ -96,7 +99,9 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
96 | } | 99 | } |
97 | 100 | ||
98 | ngOnDestroy () { | 101 | ngOnDestroy () { |
99 | this.resumableUploadService.disconnect(); | 102 | this.resumableUploadService.disconnect() |
103 | |||
104 | if (this.uploadServiceSubscription) this.uploadServiceSubscription.unsubscribe() | ||
100 | } | 105 | } |
101 | 106 | ||
102 | canDeactivate () { | 107 | canDeactivate () { |