From 36f9507ee0629cb044cab2bd0020caa54e5d4c3c Mon Sep 17 00:00:00 2001 From: luna Date: Thu, 9 Jan 2025 19:47:05 +1030 Subject: [PATCH] chore: memo image --- src/components/ui/Image.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/ui/Image.tsx b/src/components/ui/Image.tsx index 369ff4e..bf1cbc9 100644 --- a/src/components/ui/Image.tsx +++ b/src/components/ui/Image.tsx @@ -3,6 +3,7 @@ import { useSettings } from '@/hooks/useSetting'; import { cn } from '@/lib/utils'; import { Dialog, DialogContent, DialogTitle, DialogTrigger } from './dialog'; import { VisuallyHidden } from '@ariakit/react'; +import { memo } from 'react'; type ImageProps = Omit, 'className'> & { classNames?: { @@ -12,7 +13,7 @@ type ImageProps = Omit, 'className'> & clickable?: boolean; }; -export const Image = ({ src, alt, classNames, clickable = true, ...props }: ImageProps) => { +const ImageInner = ({ src, alt, classNames, clickable = true, ...props }: ImageProps) => { const { experiments } = useSettings(); const { t } = useTranslation('image'); @@ -64,3 +65,5 @@ export const Image = ({ src, alt, classNames, clickable = true, ...props }: Imag ); }; + +export const Image = memo(ImageInner);