Skip to content

Commit

Permalink
🐛 hotfix: broken clip page and generate thumbnails repeated requests
Browse files Browse the repository at this point in the history
  • Loading branch information
greatsamist committed Aug 7, 2024
1 parent 0c6f94e commit 18a5737
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
4 changes: 0 additions & 4 deletions packages/app/app/studio/[organization]/clips/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,6 @@ const EventClips = async ({ params, searchParams }: ClipsPageParams) => {
return undefined;
})();

if (!previewAsset) {
return notFound();
}

return (
<ClipContainer>
{previewAsset && (
Expand Down
10 changes: 5 additions & 5 deletions packages/app/components/misc/VideoCard/VideoCardWithMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { IExtendedSession } from '@/lib/types';
import { formatDate } from '@/lib/utils/time';
import { EllipsisVertical } from 'lucide-react';
import Link from 'next/link';
import React, { ReactNode } from 'react';
import React, { ReactNode, useMemo } from 'react';
import { useEffect, useState } from 'react';

const VideoCardWithMenu = ({
Expand All @@ -27,7 +27,7 @@ const VideoCardWithMenu = ({
link: string;
}) => {
const [thumbnail, setThumbnail] = useState<string | undefined>(undefined);

const memoizedSession = useMemo(() => session, []);
useEffect(() => {
const getThumbnail = async (session: IExtendedSession) => {
try {
Expand All @@ -38,10 +38,10 @@ const VideoCardWithMenu = ({
}
};

if (session) {
getThumbnail(session);
if (memoizedSession && !memoizedSession.coverImage) {
getThumbnail(memoizedSession);
}
}, [session]);
}, [memoizedSession]);

return (
<div className="flex min-h-full w-full flex-col rounded-xl uppercase">
Expand Down
2 changes: 1 addition & 1 deletion packages/app/lib/services/sessionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export const fetchSessionMetrics = async ({
const response = await fetch(`${apiUrl()}/streams/metric/${playbackId}`, {
cache: 'no-store',
});
console.log('response', response);

if (!response.ok) {
return {
viewCount: 0,
Expand Down

0 comments on commit 18a5737

Please sign in to comment.