aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/shared/video-playlist/video-playlist.service.ts16
1 files changed, 9 insertions, 7 deletions
diff --git a/client/src/app/shared/video-playlist/video-playlist.service.ts b/client/src/app/shared/video-playlist/video-playlist.service.ts
index 078bcc5d7..fc5eb5337 100644
--- a/client/src/app/shared/video-playlist/video-playlist.service.ts
+++ b/client/src/app/shared/video-playlist/video-playlist.service.ts
@@ -42,7 +42,7 @@ export class VideoPlaylistService {
42 private videoExistsCache: { [ id: number ]: VideoExistInPlaylist[] } = {} 42 private videoExistsCache: { [ id: number ]: VideoExistInPlaylist[] } = {}
43 43
44 private myAccountPlaylistCache: ResultList<CachedPlaylist> = undefined 44 private myAccountPlaylistCache: ResultList<CachedPlaylist> = undefined
45 private myAccountPlaylistCacheRunning = false 45 private myAccountPlaylistCacheRunning: Observable<ResultList<CachedPlaylist>>
46 private myAccountPlaylistCacheSubject = new Subject<ResultList<CachedPlaylist>>() 46 private myAccountPlaylistCacheSubject = new Subject<ResultList<CachedPlaylist>>()
47 47
48 constructor ( 48 constructor (
@@ -80,21 +80,23 @@ export class VideoPlaylistService {
80 80
81 listMyPlaylistWithCache (user: AuthUser, search?: string) { 81 listMyPlaylistWithCache (user: AuthUser, search?: string) {
82 if (!search) { 82 if (!search) {
83 if (this.myAccountPlaylistCacheRunning) return 83 if (this.myAccountPlaylistCacheRunning) return this.myAccountPlaylistCacheRunning
84 if (this.myAccountPlaylistCache) return of(this.myAccountPlaylistCache) 84 if (this.myAccountPlaylistCache) return of(this.myAccountPlaylistCache)
85 } 85 }
86 86
87 this.myAccountPlaylistCacheRunning = true 87 const obs = this.listAccountPlaylists(user.account, undefined, '-updatedAt', search)
88
89 return this.listAccountPlaylists(user.account, undefined, '-updatedAt', search)
90 .pipe( 88 .pipe(
91 tap(result => { 89 tap(result => {
92 if (!search) { 90 if (!search) {
93 this.myAccountPlaylistCacheRunning = false 91 this.myAccountPlaylistCacheRunning = undefined
94 this.myAccountPlaylistCache = result 92 this.myAccountPlaylistCache = result
95 } 93 }
96 }) 94 }),
95 share()
97 ) 96 )
97
98 if (!search) this.myAccountPlaylistCacheRunning = obs
99 return obs
98 } 100 }
99 101
100 listAccountPlaylists ( 102 listAccountPlaylists (