fix(images): restore unoptimized true for direct upload proxy serving and fix React 418 hydration mismatch
Some checks failed
Deploy Canina / deploy (push) Successful in 2m5s
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 9s

This commit is contained in:
parsa aghaei 2026-09-02 15:36:03 +03:30
parent e081441c22
commit 1ca06d5740
2 changed files with 10 additions and 7 deletions

View File

@ -147,7 +147,7 @@ export default function Hero({ banners = [], onShopNavigate }: { banners?: Banne
}}
className="bg-canina-blue text-white px-3 sm:px-10 py-2 sm:py-5 rounded-full font-bold text-lg hover:bg-canina-blue/90 hover:shadow-2xl focus-visible:ring-4 focus-visible:ring-canina-blue/30 focus-visible:outline-none transition-all flex items-center gap-2 group font-vazir min-h-[58px] shadow-lg shadow-canina-blue/20 cursor-pointer"
>
{getText('hero_btn_advisor', "دستیار سلامت پت")}
<span suppressHydrationWarning>{mounted && isInitialized ? getText('hero_btn_advisor', "دستیار سلامت پت") : "دستیار سلامت پت"}</span>
<ChevronLeft className="w-5 h-5 group-hover:-translate-x-1 transition-transform" />
</button>
<button
@ -160,7 +160,7 @@ export default function Hero({ banners = [], onShopNavigate }: { banners?: Banne
}}
className="bg-white border-2 border-medical-gray-900 text-medical-gray-900 px-3 sm:px-10 py-2 sm:py-5 rounded-full font-bold text-lg hover:bg-medical-gray-50 focus-visible:ring-4 focus-visible:ring-canina-blue/30 focus-visible:outline-none transition-all font-vazir min-h-[58px] shadow-sm cursor-pointer"
>
{getText('hero_btn_products', "مشاهده محصولات")}
<span suppressHydrationWarning>{mounted && isInitialized ? getText('hero_btn_products', "مشاهده محصولات") : "مشاهده محصولات"}</span>
</button>
</div>
</div>
@ -198,8 +198,7 @@ export default function Hero({ banners = [], onShopNavigate }: { banners?: Banne
alt={banner.title || "Canina Pharma Germany"}
fill
priority={idx === 0}
sizes="(max-width: 1024px) 100vw, 600px"
quality={85}
unoptimized={true}
className="object-cover"
/>
</motion.div>
@ -211,8 +210,7 @@ export default function Hero({ banners = [], onShopNavigate }: { banners?: Banne
alt={activeBanner?.title || "Canina Pharma Germany"}
fill
priority
sizes="(max-width: 1024px) 100vw, 600px"
quality={85}
unoptimized={true}
className="object-cover"
/>
</div>

View File

@ -104,7 +104,12 @@ export default function SafeImage({
unoptimized={
isBlobOrData ||
!isAllowedHost ||
(typeof src === 'string' && src.toLowerCase().endsWith('.svg'))
(typeof src === 'string' && (
src.startsWith('/api/uploads/') ||
src.startsWith('/api/media/') ||
src.startsWith('/uploads/') ||
src.toLowerCase().endsWith('.svg')
))
}
className={cn(
"transition-all duration-500 w-full h-full object-contain",