fix: 上传面板关闭动效避开 contextSafe 可能为空

This commit is contained in:
chenpei 2026-08-19 11:22:45 +08:00
parent 4efdccdd3c
commit 23083c2ef5

View File

@ -265,6 +265,8 @@ export default function UploadModal({ onClose, onSuccess }: UploadModalProps) {
) )
}) })
if (!contextSafe) return
closeAnimatedRef.current = contextSafe(() => { closeAnimatedRef.current = contextSafe(() => {
const reduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches const reduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches
if (reduced || !overlayRef.current || !panelRef.current) { if (reduced || !overlayRef.current || !panelRef.current) {