mirror of
https://github.com/kyantech/Palmr.git
synced 2026-01-09 06:02:28 +08:00
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:
parent
bb7872eed1
commit
00174fd9af
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user