TagSpaces is an offline, open source, document manager with tagging support
Load tmb image first in the image viewer
Stanimir6650badd0705
diff --git a/src/renderer/components/FileView.tsx b/src/renderer/components/FileView.tsxindex 7b7edabc3..9fc31d670 100644--- a/src/renderer/components/FileView.tsx+++ b/src/renderer/components/FileView.tsx@@ -33,8 +33,10 @@ import {useEffect,useReducer,useRef,+ useState,} from 'react';import { useTranslation } from 'react-i18next';+import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';interface Props {fileViewer: MutableRefObject<HTMLIFrameElement>;@@ -53,6 +55,7 @@ function FileView(props: Props) {const { setFullscreen, isFullscreen, toggleFullScreen } =useFullScreenContext();const { searchQuery, isSearchMode } = useDirectoryContentContext();+ const { findLocation } = useCurrentLocationContext();const {fileViewer,fileViewerContainer,@@ -62,6 +65,8 @@ function FileView(props: Props) {} = props;const eventID = useRef<string>(getUuid());+ const [thumb, setThumb] = useState<string | null>(null);+ const [loadingThumb, setLoadingThumb] = useState(true);const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);useEffect(() => {@@ -95,6 +100,19 @@ function FileView(props: Props) {};}, []);+ useEffect(() => {+ setLoadingThumb(true);+ const loc = findLocation(openedEntry.locationID);+ loc+ ?.getThumbPath(openedEntry.meta.thumbPath, openedEntry.meta.lastUpdated)+ .then((t) => {+ setThumb(t);+ })+ .finally(() => {+ setLoadingThumb(false);+ });+ }, [openedEntry]);+const handleFullscreenChange = useCallback((e) => {let change = '';if (fscreen.fullscreenElement !== null) {@@ -218,9 +236,8 @@ function FileView(props: Props) {? '&query=' + encodeURIComponent(searchQuery.textQuery): '';const locale = '&locale=' + i18n.language;- const thumb = openedEntry.meta?.thumbPath- ? '&thumb=' + encodeURIComponent(openedEntry.meta?.thumbPath)- : '';++ const thumbParam = thumb ? '&thumb=' + encodeURIComponent(thumb) : '';const theming ='&theme=' +theme.palette.mode +@@ -234,7 +251,7 @@ function FileView(props: Props) {encodeURIComponent(openedEntry.url ? openedEntry.url : openedEntry.path,) +- thumb ++ thumbParam +locale +theming +extQuery +@@ -284,7 +301,7 @@ function FileView(props: Props) {<span>ESC</span></div>)}- {openedEntry.isFile && (+ {openedEntry.isFile && !loadingThumb && (<iframeref={fileViewer}style={{