From 6a2b3f2616faca6c5e2b11133676791754a1c37d Mon Sep 17 00:00:00 2001 From: Saliou Diallo Date: Tue, 9 Jan 2024 09:57:51 -0500 Subject: [PATCH] [PAY-2340] Fix dms playlist unfurl (#7119) Co-authored-by: Saliou Diallo --- .../screens/chat-screen/ChatMessagePlaylist.tsx | 15 ++++++--------- .../chat-page/components/ChatMessagePlaylist.tsx | 15 ++++++--------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/packages/mobile/src/screens/chat-screen/ChatMessagePlaylist.tsx b/packages/mobile/src/screens/chat-screen/ChatMessagePlaylist.tsx index 14e55599d0d..44f7735fa86 100644 --- a/packages/mobile/src/screens/chat-screen/ChatMessagePlaylist.tsx +++ b/packages/mobile/src/screens/chat-screen/ChatMessagePlaylist.tsx @@ -10,11 +10,10 @@ import { getPathFromPlaylistUrl, makeUid, playerSelectors, - useGetPlaylistById, useGetTracksByIds, usePlayTrack, usePauseTrack, - parsePlaylistIdFromPermalink + useGetPlaylistByPermalink } from '@audius/common' import { useSelector } from 'react-redux' @@ -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(() => { diff --git a/packages/web/src/pages/chat-page/components/ChatMessagePlaylist.tsx b/packages/web/src/pages/chat-page/components/ChatMessagePlaylist.tsx index b477a108dfb..45862a1807f 100644 --- a/packages/web/src/pages/chat-page/components/ChatMessagePlaylist.tsx +++ b/packages/web/src/pages/chat-page/components/ChatMessagePlaylist.tsx @@ -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' @@ -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