TagSpaces is an offline, open source, document manager with tagging support
fix file size calculation
sytolkeb4e30375f15
diff --git a/src/renderer/components/EntryProperties.tsx b/src/renderer/components/EntryProperties.tsxindex 60c91cef0..8e6278828 100644--- a/src/renderer/components/EntryProperties.tsx+++ b/src/renderer/components/EntryProperties.tsx@@ -841,7 +841,7 @@ function EntryProperties(props: Props) {<Tooltiptitle={!PlatformIO.haveObjectStoreSupport() &&- dirProps &&+ (dirProps.dirsCount || dirProps.filesCount) &&!openedEntry.isFile &&dirProps.dirsCount +' ' +diff --git a/src/renderer/components/SearchAutocomplete.tsx b/src/renderer/components/SearchAutocomplete.tsxindex 64ec6d673..9f2b8f830 100644--- a/src/renderer/components/SearchAutocomplete.tsx+++ b/src/renderer/components/SearchAutocomplete.tsx@@ -64,7 +64,6 @@ import { useTranslation } from 'react-i18next';import { useOpenedEntryContext } from '-/hooks/useOpenedEntryContext';import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';import { useDirectoryContentContext } from '-/hooks/useDirectoryContentContext';-import { useNotificationContext } from '-/hooks/useNotificationContext';import { useLocationIndexContext } from '-/hooks/useLocationIndexContext';interface Props {diff --git a/src/renderer/hooks/OpenedEntryContextProvider.tsx b/src/renderer/hooks/OpenedEntryContextProvider.tsxindex 0ccd71622..468848d06 100644--- a/src/renderer/hooks/OpenedEntryContextProvider.tsx+++ b/src/renderer/hooks/OpenedEntryContextProvider.tsx@@ -153,7 +153,11 @@ export const OpenedEntryContextProvider = ({);const newHTMLFileContent = useSelector(getNewHTMLFileContent);const currentEntry = useRef<OpenedEntry>(undefined);- const dirProps = useRef<TS.DirProp>();+ const dirProps = useRef<TS.DirProp>({+ totalSize: undefined,+ filesCount: undefined,+ dirsCount: undefined,+ });const isEntryInFullWidth = useRef<boolean>(false);const sharingLink = useRef<string>(undefined);const sharingParentFolderLink = useRef<string>(undefined);@@ -178,7 +182,11 @@ export const OpenedEntryContextProvider = ({openLink('ts://?cmdopen=' + cmdOpen, { fullWidth: true });}, 1000);}- } else if (+ }+ }, []);++ useEffect(() => {+ if (currentEntry.current &&!currentEntry.current.isFile &&!PlatformIO.haveObjectStoreSupport() &&@@ -186,13 +194,17 @@ export const OpenedEntryContextProvider = ({) {PlatformIO.getDirProperties(currentEntry.current.path).then((dProps: TS.DirProp) => {- dirProps.current = dProps;+ if (dProps) {+ dirProps.current.dirsCount = dProps.dirsCount;+ dirProps.current.filesCount = dProps.filesCount;+ dirProps.current.totalSize = dProps.totalSize;+ }currentEntry.current.size = dProps.totalSize;- forceUpdate();+ //forceUpdate();}).catch((ex) => console.debug('getDirProperties:', ex.message));}- }, []);+ }, [currentEntry.current]);useEffect(() => {if (actions && actions.length > 0) {@@ -859,7 +871,7 @@ export const OpenedEntryContextProvider = ({}, [currentEntry.current,isEntryInFullWidth.current,- dirProps.current,+ // dirProps.current,currentLocation,currentDirectoryPath,fileOpenHistory,