Skip to content

Commit

Permalink
[PAY-2340] Fix dms playlist unfurl (#7119)
Browse files Browse the repository at this point in the history
Co-authored-by: Saliou Diallo <saliou@audius.co>
  • Loading branch information
sddioulde and Saliou Diallo authored Jan 9, 2024
1 parent 45ad02c commit 6a2b3f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
15 changes: 6 additions & 9 deletions packages/mobile/src/screens/chat-screen/ChatMessagePlaylist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ import {
getPathFromPlaylistUrl,
makeUid,
playerSelectors,
useGetPlaylistById,
useGetTracksByIds,
usePlayTrack,
usePauseTrack,
parsePlaylistIdFromPermalink
useGetPlaylistByPermalink
} from '@audius/common'
import { useSelector } from 'react-redux'

Expand All @@ -35,15 +34,13 @@ export const ChatMessagePlaylist = ({
const playingTrackId = useSelector(getTrackId)
const playingUid = useSelector(getUid)

const playlistId = parsePlaylistIdFromPermalink(
getPathFromPlaylistUrl(link) ?? ''
)
const { data: playlist } = useGetPlaylistById(
const permalink = getPathFromPlaylistUrl(link) ?? ''
const { data: playlist } = useGetPlaylistByPermalink(
{
playlistId,
currentUserId
permalink,
currentUserId: currentUserId!
},
{ disabled: !playlistId }
{ disabled: !permalink || !currentUserId }
)

const collection = useMemo(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@ import {
QueueSource,
playerSelectors,
getPathFromPlaylistUrl,
useGetPlaylistById,
accountSelectors,
useGetTracksByIds,
usePlayTrack,
usePauseTrack,
ChatMessageTileProps,
parsePlaylistIdFromPermalink,
SquareSizes,
cacheCollectionsActions,
cacheCollectionsSelectors,
CommonState,
Name
Name,
useGetPlaylistByPermalink
} from '@audius/common'
import { useDispatch, useSelector } from 'react-redux'

Expand All @@ -41,15 +40,13 @@ export const ChatMessagePlaylist = ({
const currentUserId = useSelector(getUserId)
const playingTrackId = useSelector(getTrackId)

const playlistId = parsePlaylistIdFromPermalink(
getPathFromPlaylistUrl(link) ?? ''
)
const { data: playlist, status } = useGetPlaylistById(
const permalink = getPathFromPlaylistUrl(link) ?? ''
const { data: playlist, status } = useGetPlaylistByPermalink(
{
playlistId,
permalink,
currentUserId: currentUserId!
},
{ disabled: !playlistId || !currentUserId }
{ disabled: !permalink || !currentUserId }
)

const collectionId = playlist?.playlist_id
Expand Down

0 comments on commit 6a2b3f2

Please sign in to comment.