diff --git a/components/PartyDetails/index.tsx b/components/PartyDetails/index.tsx index a9b0969e..5b94f1fc 100644 --- a/components/PartyDetails/index.tsx +++ b/components/PartyDetails/index.tsx @@ -66,11 +66,6 @@ const PartyDetails = (props: Props) => { Visible: open, }) - const emptyClasses = classNames({ - EmptyDetails: true, - Visible: true, - }) - const userClass = classNames({ user: true, empty: !party.user, @@ -110,9 +105,8 @@ const PartyDetails = (props: Props) => { useEffect(() => { // Extract the video IDs from the description - if (party.description) { - // sanitizeHtml(party.description) - const videoIds = extractYoutubeVideoIds(party.description) + if (appState.party.description) { + const videoIds = extractYoutubeVideoIds(appState.party.description) // Fetch the video titles for each ID const fetchPromises = videoIds.map(({ id }) => fetchYoutubeData(id)) @@ -124,10 +118,11 @@ const PartyDetails = (props: Props) => { /https:\/\/www\.youtube\.com\/watch\?v=([\w-]+)/g // Replace the video URLs in the description with LiteYoutubeEmbed elements const newDescription = reactStringReplace( - party.description, + appState.party.description, youtubeUrlRegex, (match, i) => ( { // Update the state with the new description setEmbeddedDescription(newDescription) }) + } else { + setEmbeddedDescription('') } - }, [party.description]) + }, [appState.party.description]) async function fetchYoutubeData(videoId: string) { return await youtube