From 9ad0ccdd3effea3fc2d0a5da46086442cd01957b Mon Sep 17 00:00:00 2001 From: Gauthier Date: Sun, 10 Nov 2024 22:37:33 +0100 Subject: [PATCH] perf(blacklist): request data only when modal is shown For admin users, the button to blacklist a media (used on every media card) was displaying a Modal, that was requesting data BEFORE the modal was displayed. This resulted in dozens of additional requests everytime media cards were displayed. --- src/components/BlacklistModal/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/BlacklistModal/index.tsx b/src/components/BlacklistModal/index.tsx index aeca8d411..def49c135 100644 --- a/src/components/BlacklistModal/index.tsx +++ b/src/components/BlacklistModal/index.tsx @@ -38,7 +38,7 @@ const BlacklistModal = ({ const intl = useIntl(); const { data, error } = useSWR( - `/api/v1/${type}/${tmdbId}` + show ? `/api/v1/${type}/${tmdbId}` : null ); return (