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

[C-2167] Deduplicate explore playlists #2885

Merged
merged 2 commits into from
Feb 17, 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
6 changes: 6 additions & 0 deletions packages/web/craco.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ export default {
exclude: /node_modules/,
use: ['raw-loader', 'glslify-loader'],
type: 'javascript/auto'
},
{
test: /\.m?js$/,
resolve: {
fullySpecified: false // disable the behavior
}
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import {
Collection,
explorePageCollectionsActions,
ExploreCollectionsVariant,
getContext
getContext,
UserCollectionMetadata
} from '@audius/common'
import { uniq } from 'lodash'
import { takeEvery, call, put } from 'typed-redux-saga'

import { processAndCacheCollections } from 'common/store/cache/collections/utils'
Expand Down Expand Up @@ -53,7 +55,7 @@ function* watchFetch() {

const { variant, moods } = action.payload

let collections
let collections: UserCollectionMetadata[] | Collection[] | undefined
if (variant === ExploreCollectionsVariant.MOOD) {
collections = yield* call(
fetchMap[ExploreCollectionsVariant.MOOD],
Expand All @@ -62,7 +64,7 @@ function* watchFetch() {
} else if (variant === ExploreCollectionsVariant.DIRECT_LINK) {
// no-op
} else {
collections = yield* call(fetchMap[variant]) as any
collections = yield* call(fetchMap[variant])
}
if (!collections) return

Expand All @@ -72,7 +74,9 @@ function* watchFetch() {
/* shouldRetrieveTracks= */ false
)

const collectionIds = collections.map((c: Collection) => c.playlist_id)
const collectionIds = uniq(
collections.map((c: UserCollectionMetadata | Collection) => c.playlist_id)
)

yield* put(
fetchSucceeded({
Expand Down