From 606f9af1bae50914f0ed8df5d738bbc189a72f5c Mon Sep 17 00:00:00 2001 From: codytseng Date: Sat, 15 Nov 2025 11:46:57 +0800 Subject: [PATCH] fix: show profile banner and avatar when media auto-load is disabled --- src/components/ImageWithLightbox/index.tsx | 6 ++++-- src/components/Profile/AvatarWithLightbox.tsx | 1 + src/components/Profile/BannerWithLightbox.tsx | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/ImageWithLightbox/index.tsx b/src/components/ImageWithLightbox/index.tsx index c987107..1616ea6 100644 --- a/src/components/ImageWithLightbox/index.tsx +++ b/src/components/ImageWithLightbox/index.tsx @@ -14,7 +14,8 @@ export default function ImageWithLightbox({ image, className, classNames = {}, - errorPlaceholder + errorPlaceholder, + ignoreAutoLoadPolicy = false }: { image: TImetaInfo className?: string @@ -22,11 +23,12 @@ export default function ImageWithLightbox({ wrapper?: string } errorPlaceholder?: string + ignoreAutoLoadPolicy?: boolean }) { const id = useMemo(() => `image-with-lightbox-${randomString()}`, []) const { t } = useTranslation() const { autoLoadMedia } = useContentPolicy() - const [display, setDisplay] = useState(autoLoadMedia) + const [display, setDisplay] = useState(ignoreAutoLoadPolicy ? true : autoLoadMedia) const [index, setIndex] = useState(-1) useEffect(() => { if (index >= 0) { diff --git a/src/components/Profile/AvatarWithLightbox.tsx b/src/components/Profile/AvatarWithLightbox.tsx index 7685f7d..dfbac13 100644 --- a/src/components/Profile/AvatarWithLightbox.tsx +++ b/src/components/Profile/AvatarWithLightbox.tsx @@ -27,6 +27,7 @@ export default function AvatarWithLightbox({ userId }: { userId: string }) { wrapper: 'shrink-0 rounded-full bg-background w-24 h-24 absolute left-3 bottom-0 translate-y-1/2 border-4 border-background' }} + ignoreAutoLoadPolicy /> ) } diff --git a/src/components/Profile/BannerWithLightbox.tsx b/src/components/Profile/BannerWithLightbox.tsx index 4beda1d..58eeb4c 100644 --- a/src/components/Profile/BannerWithLightbox.tsx +++ b/src/components/Profile/BannerWithLightbox.tsx @@ -28,6 +28,7 @@ export default function BannerWithLightbox({ wrapper: 'rounded-none border-none' }} errorPlaceholder={defaultBanner} + ignoreAutoLoadPolicy /> ) }