aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/video-playlist/video-playlist.service.ts13
1 files changed, 11 insertions, 2 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 1ec9315ef..078bcc5d7 100644
--- a/client/src/app/shared/video-playlist/video-playlist.service.ts
+++ b/client/src/app/shared/video-playlist/video-playlist.service.ts
@@ -42,6 +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 myAccountPlaylistCacheSubject = new Subject<ResultList<CachedPlaylist>>() 46 private myAccountPlaylistCacheSubject = new Subject<ResultList<CachedPlaylist>>()
46 47
47 constructor ( 48 constructor (
@@ -78,12 +79,20 @@ export class VideoPlaylistService {
78 } 79 }
79 80
80 listMyPlaylistWithCache (user: AuthUser, search?: string) { 81 listMyPlaylistWithCache (user: AuthUser, search?: string) {
81 if (!search && this.myAccountPlaylistCache) return of(this.myAccountPlaylistCache) 82 if (!search) {
83 if (this.myAccountPlaylistCacheRunning) return
84 if (this.myAccountPlaylistCache) return of(this.myAccountPlaylistCache)
85 }
86
87 this.myAccountPlaylistCacheRunning = true
82 88
83 return this.listAccountPlaylists(user.account, undefined, '-updatedAt', search) 89 return this.listAccountPlaylists(user.account, undefined, '-updatedAt', search)
84 .pipe( 90 .pipe(
85 tap(result => { 91 tap(result => {
86 if (!search) this.myAccountPlaylistCache = result 92 if (!search) {
93 this.myAccountPlaylistCacheRunning = false
94 this.myAccountPlaylistCache = result
95 }
87 }) 96 })
88 ) 97 )
89 } 98 }