Skip to content

Commit

Permalink
[QA-733] Dedupe albums and playlists on profile (#7316)
Browse files Browse the repository at this point in the history
  • Loading branch information
amendelsohn authored Jan 24, 2024
1 parent dcc2f61 commit 1329083
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions packages/common/src/store/pages/profile/selectors.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { uniq } from 'lodash'

import { getCollections } from 'store/cache/collections/selectors'
import { getUser, getUsers } from 'store/cache/users/selectors'
import type { CommonState } from 'store/commonStore'
Expand Down Expand Up @@ -104,12 +106,12 @@ export const getProfileCollections = createDeepEqualSelector(

export const getProfileAlbums = createDeepEqualSelector(
[getProfileCollections],
(collections) => collections?.filter(({ is_album }) => is_album)
(collections) => uniq(collections?.filter(({ is_album }) => is_album))
)

export const getProfilePlaylists = createDeepEqualSelector(
[getProfileCollections],
(collections) => collections?.filter(({ is_album }) => !is_album)
(collections) => uniq(collections?.filter(({ is_album }) => !is_album))
)

const sortByDateDesc = (a: Collection, b: Collection) =>
Expand Down
5 changes: 3 additions & 2 deletions packages/web/src/pages/profile-page/ProfilePageProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import {
} from '@audius/common'
import { push as pushRoute, replace } from 'connected-react-router'
import { UnregisterCallback } from 'history'
import { uniq } from 'lodash'
import moment from 'moment'
import { connect } from 'react-redux'
import { withRouter, RouteComponentProps } from 'react-router-dom'
Expand Down Expand Up @@ -904,8 +905,8 @@ class ProfilePage extends PureComponent<ProfilePageProps, ProfilePageState> {

profile,
status: profileLoadingStatus,
albums,
playlists,
albums: uniq(albums),
playlists: uniq(playlists),
artistTracks,
playArtistTrack,
pauseArtistTrack,
Expand Down

0 comments on commit 1329083

Please sign in to comment.