Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix Setting thumbnail from the context menu not shown immediately

sytolk2a925d3c6b76
diff --git a/app/components/DirectoryTreeView.tsx b/app/components/DirectoryTreeView.tsx
index 0d4289913..a62a19905 100644
--- a/app/components/DirectoryTreeView.tsx
+++ b/app/components/DirectoryTreeView.tsx
@@ -26,7 +26,6 @@ import DragItemTypes from '-/components/DragItemTypes';
import PlatformIO from '-/services/platform-facade';
import TargetTableMoveFileBox from '-/components/TargetTableMoveFileBox';
import { TS } from '-/tagspaces.namespace';
-import { actions as AppActions, AppDispatch } from '-/reducers/app';
import { getShowUnixHiddenEntries } from '-/reducers/settings';
import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';
import { useDirectoryContentContext } from '-/hooks/useDirectoryContentContext';
diff --git a/app/hooks/PlatformFacadeContextProvider.tsx b/app/hooks/PlatformFacadeContextProvider.tsx
index 7f57206e0..3985587c2 100644
--- a/app/hooks/PlatformFacadeContextProvider.tsx
+++ b/app/hooks/PlatformFacadeContextProvider.tsx
@@ -30,6 +30,8 @@ import {
} from '@tagspaces/tagspaces-common/paths';
import PlatformIO from '-/services/platform-facade';
import { useTranslation } from 'react-i18next';
+import { actions as AppActions, AppDispatch } from '-/reducers/app';
+import { useDispatch } from 'react-redux';
type PlatformFacadeContextData = {
createDirectoryPromise: (path: string) => Promise<any>;
@@ -121,6 +123,7 @@ export const PlatformFacadeContextProvider = ({
const { ignoreByWatcher, deignoreByWatcher, ignored } = useFSWatcherContext();
const { t } = useTranslation();
+ const dispatch: AppDispatch = useDispatch();
/*function enableObjectStoreSupport(objectStoreConfig: any): Promise<any> {
return platformEnableObjectStoreSupport(objectStoreConfig);
@@ -172,18 +175,25 @@ export const PlatformFacadeContextProvider = ({
directoryPath,
PlatformIO.getDirSeparator()
);
+ const sourceThumbPath = getThumbFileLocationForFile(
+ filePath,
+ PlatformIO.getDirSeparator(),
+ false
+ );
+
+ const destThumbPath = getThumbFileLocationForDirectory(
+ directoryPath,
+ PlatformIO.getDirSeparator()
+ );
+
return copyFilePromise(
- getThumbFileLocationForFile(
- filePath,
- PlatformIO.getDirSeparator(),
- false
- ),
- getThumbFileLocationForDirectory(
- directoryPath,
- PlatformIO.getDirSeparator()
- ),
+ sourceThumbPath,
+ destThumbPath,
t('core:thumbAlreadyExists', { directoryName })
- ).then(() => directoryPath);
+ ).then(() => {
+ dispatch(AppActions.setLastThumbnailImageChange(destThumbPath));
+ return directoryPath;
+ });
}
function copyFilePromise(