fix: 素材网格骨架动效避开服务端预渲染访问 window

This commit is contained in:
chenpei 2026-08-17 11:59:57 +08:00
parent 5f2eb55478
commit 32610b5527

View File

@ -52,7 +52,7 @@ function MaterialGridSkeleton() {
const rootRef = useRef<HTMLDivElement>(null)
useGSAP(() => {
if (typeof window.matchMedia !== 'function') return
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return
const motion = gsap.matchMedia()
motion.add('(prefers-reduced-motion: no-preference)', () => {