import { Video } from '@app/shared/video/video.model'
import { RecommendationInfo } from '@app/shared/video/recommendation-info.model'
import { RecentVideosRecommendationService } from '@app/videos/recommendations/recent-videos-recommendation.service'
-import { RecommendationService, UUID } from '@app/videos/recommendations/recommendations.service'
-import { map, switchMap, take } from 'rxjs/operators'
+import { RecommendationService } from '@app/videos/recommendations/recommendations.service'
+import { map, shareReplay, switchMap, take } from 'rxjs/operators'
/**
* This store is intended to provide data for the RecommendedVideosComponent.
@Inject(RecentVideosRecommendationService) private recommendations: RecommendationService
) {
this.recommendations$ = this.requestsForLoad$$.pipe(
- switchMap(requestedRecommendation => recommendations.getRecommendations(requestedRecommendation)
- .pipe(take(1))
- ))
+ switchMap(requestedRecommendation => {
+ return recommendations.getRecommendations(requestedRecommendation)
+ .pipe(take(1))
+ }),
+ shareReplay()
+ )
+
this.hasRecommendations$ = this.recommendations$.pipe(
map(otherVideos => otherVideos.length > 0)
)