Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

[C-2844] Ensure all tracks fetched on collection page #3734

Merged
merged 1 commit into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,13 @@ function* selectEntriesTimestamp(ids: (ID | string)[]) {

export function* retrieveCollectionByPermalink(
permalink: string,
/**
* whether or not to fetch the tracks inside the playlist
*/
fetchTracks = false,
/**
* whether or not fetching this collection requires it to have all its tracks.
* In the case where a collection is already cached with partial tracks, use this flag to refetch from source.
*/
requiresAllTracks = false
config?: RetrieveCollectionsConfig
) {
const {
fetchTracks = false,
requiresAllTracks = false,
forceRetrieveFromSource = false
} = config ?? {}
// @ts-ignore retrieve should be refactored to ts first
const { entries, uids } = yield* call(retrieve, {
ids: [permalink],
Expand Down Expand Up @@ -215,7 +212,7 @@ export function* retrieveCollectionByPermalink(
},
kind: Kind.COLLECTIONS,
idField: 'playlist_id',
forceRetrieveFromSource: false,
forceRetrieveFromSource,
shouldSetLoading: true,
deleteExistingEntry: false
})
Expand Down
9 changes: 6 additions & 3 deletions packages/web/src/common/store/pages/collection/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ function* watchFetchCollection() {
retrievedCollections = yield call(
retrieveCollectionByPermalink,
permalink,
/* fetchTracks */ false,
/* requiresAllTracks */ true
{
requiresAllTracks: true
}
)
} else {
retrievedCollections = yield call(retrieveCollections, [collectionId])
retrievedCollections = yield call(retrieveCollections, [collectionId], {
requiresAllTracks: true
})
}

const { collections, uids: collectionUids } = retrievedCollections
Expand Down