From a5ffa2677d185e9e8f0adfdd98d66c83f722fe3b Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 10 Jun 2025 18:09:11 +0200 Subject: [PATCH] refactor(MetaPreview): remove use of metaId for Rate action --- src/components/MetaPreview/MetaPreview.js | 1 - src/components/MetaPreview/Ratings/Ratings.tsx | 4 ++-- src/components/MetaPreview/Ratings/useRating.ts | 7 ++----- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/components/MetaPreview/MetaPreview.js b/src/components/MetaPreview/MetaPreview.js index 184eeb5cf..5de21dc78 100644 --- a/src/components/MetaPreview/MetaPreview.js +++ b/src/components/MetaPreview/MetaPreview.js @@ -236,7 +236,6 @@ const MetaPreview = React.forwardRef(({ className, compact, name, logo, backgrou { !compact ? diff --git a/src/components/MetaPreview/Ratings/Ratings.tsx b/src/components/MetaPreview/Ratings/Ratings.tsx index 861776f32..5ede48dd9 100644 --- a/src/components/MetaPreview/Ratings/Ratings.tsx +++ b/src/components/MetaPreview/Ratings/Ratings.tsx @@ -17,8 +17,8 @@ type Props = { className?: string; }; -const Ratings = ({ metaId, like, className }: Props) => { - const { onLiked, onLoved, liked, loved } = useRating(metaId, like); +const Ratings = ({ like, className }: Props) => { + const { onLiked, onLoved, liked, loved } = useRating(like); const disabled = useMemo(() => like?.type !== 'Ready', [like]); return ( diff --git a/src/components/MetaPreview/Ratings/useRating.ts b/src/components/MetaPreview/Ratings/useRating.ts index c15f6605e..8d7b09cf5 100644 --- a/src/components/MetaPreview/Ratings/useRating.ts +++ b/src/components/MetaPreview/Ratings/useRating.ts @@ -8,7 +8,7 @@ type Like = { type: 'Ready' | 'Loading' | 'Error'; }; -const useRating = (metaId?: string, like?: Like) => { +const useRating = (like?: Like) => { const { core } = useServices(); const setRating = useCallback((status: 'liked' | 'loved' | null) => { @@ -16,10 +16,7 @@ const useRating = (metaId?: string, like?: Like) => { action: 'MetaDetails', args: { action: 'Rate', - args: { - id: metaId, - status, - }, + args: status, }, }); }, []);