fix: remove unnecessary loading state check in useFilePreview hook

- Eliminated the check for state.isLoadingPreview in the loadPreview function to simplify the loading logic.
- Cleaned up the parameters passed to the useFilePreview hook by removing the unused loading state, enhancing code clarity.
This commit is contained in:
Daniel Luiz Alves 2025-07-01 01:59:24 -03:00
parent bb7872eed1
commit 00174fd9af

View File

@ -167,7 +167,7 @@ export function useFilePreview({ file, isOpen, isReverseShare = false }: UseFile
const loadPreview = useCallback(async () => {
const fileKey = isReverseShare ? file.id : file.objectName;
if (!fileKey || state.isLoadingPreview || loadingRef.current) return;
if (!fileKey || loadingRef.current) return;
loadingRef.current = true;
setState((prev) => ({ ...prev, isLoadingPreview: true }));
@ -216,7 +216,6 @@ export function useFilePreview({ file, isOpen, isReverseShare = false }: UseFile
isReverseShare,
file.id,
file.objectName,
state.isLoadingPreview,
fileType,
loadVideoPreview,
loadAudioPreview,