diff --git a/napcat.webui/src/components/file_manage/file_preview_modal.tsx b/napcat.webui/src/components/file_manage/file_preview_modal.tsx index 792c127f..3bb23bfe 100644 --- a/napcat.webui/src/components/file_manage/file_preview_modal.tsx +++ b/napcat.webui/src/components/file_manage/file_preview_modal.tsx @@ -9,6 +9,7 @@ import { import { Spinner } from '@heroui/spinner' import { useRequest } from 'ahooks' import path from 'path-browserify' +import { useEffect } from 'react' import FileManager from '@/controllers/file_manager' @@ -33,6 +34,7 @@ export default function FilePreviewModal({ async () => FileManager.downloadToURL(filePath), { refreshDeps: [filePath], + manual: true, refreshDepsAction: () => { const ext = path.extname(filePath).toLowerCase() if (!filePath || !supportedPreviewExts.includes(ext)) { @@ -66,6 +68,12 @@ export default function FilePreviewModal({ ) } + useEffect(() => { + if (filePath) { + run() + } + }, []) + return ( diff --git a/napcat.webui/src/components/file_manage/image_name_button.tsx b/napcat.webui/src/components/file_manage/image_name_button.tsx index b39a2bb6..cc3e2194 100644 --- a/napcat.webui/src/components/file_manage/image_name_button.tsx +++ b/napcat.webui/src/components/file_manage/image_name_button.tsx @@ -33,6 +33,7 @@ export default function ImageNameButton({ async () => FileManager.downloadToURL(filePath), { refreshDeps: [filePath], + manual: true, refreshDepsAction: () => { const ext = path.extname(filePath).toLowerCase() if (!filePath || !imageExts.includes(ext)) { @@ -52,6 +53,11 @@ export default function ImageNameButton({ } }, [data, name, onAddPreview]) + useEffect(() => { + if (filePath) { + run() + } + }, []) return (