TagSpaces is an offline, open source, document manager with tagging support
fix watch for changes in search
sytolk9c17e36b8059
diff --git a/app/components/SearchInline.tsx b/app/components/SearchInline.tsxindex 157477765..5d88e47d7 100644--- a/app/components/SearchInline.tsx+++ b/app/components/SearchInline.tsx@@ -59,6 +59,7 @@ import AppConfig from '-/AppConfig';interface Props {style?: any;+ watchForChanges: () => void;searchLocationIndex: (searchQuery: TS.SearchQuery) => void;createLocationsIndexes: () => void;searchAllLocations: (searchQuery: TS.SearchQuery) => void;@@ -288,6 +289,7 @@ function SearchInline(props: Props) {forceIndexing.current = false;fileSize.current = '';props.setSearchQuery({});+ props.watchForChanges();// props.openCurrentDirectory();};@@ -561,7 +563,8 @@ function mapDispatchToProps(dispatch) {// loadDirectoryContent: AppActions.loadDirectoryContent,openLink: AppActions.openLink,openURLExternally: AppActions.openURLExternally,- openCurrentDirectory: AppActions.openCurrentDirectory+ openCurrentDirectory: AppActions.openCurrentDirectory,+ watchForChanges: AppActions.watchForChanges},dispatch);diff --git a/app/reducers/app.ts b/app/reducers/app.tsindex 5578b56d6..2922240b6 100644--- a/app/reducers/app.ts+++ b/app/reducers/app.ts@@ -1805,16 +1805,25 @@ export const actions = {));}- if (Pro && Pro.Watcher && location.watchForChanges) {- const perspective = getCurrentDirectoryPerspective(getState());- const depth = perspective === PerspectiveIDs.KANBAN ? 3 : 1;- Pro.Watcher.watchFolder(- PlatformIO.getLocationPath(location),- dispatch,- actions,- depth- );- }+ dispatch(actions.watchForChanges(location));+ }+ },+ watchForChanges: (location?: TS.Location) => (+ dispatch: (action) => void,+ getState: () => any+ ) => {+ if (location === undefined) {+ location = getLocation(getState(), getState().app.currentLocationId);+ }+ if (Pro && Pro.Watcher && location.watchForChanges) {+ const perspective = getCurrentDirectoryPerspective(getState());+ const depth = perspective === PerspectiveIDs.KANBAN ? 3 : 1;+ Pro.Watcher.watchFolder(+ PlatformIO.getLocationPath(location),+ dispatch,+ actions,+ depth+ );}},closeLocation: (locationId: string) => (diff --git a/app/services/utils-io.ts b/app/services/utils-io.tsindex 7a9336223..1d6357f8e 100644--- a/app/services/utils-io.ts+++ b/app/services/utils-io.ts@@ -21,8 +21,7 @@ import { marked } from 'marked';import DOMPurify from 'dompurify';import {loadIndex,- enhanceDirectoryIndex,- getMetaIndexFilePath+ enhanceDirectoryIndex} from '@tagspaces/tagspaces-platforms/indexer';import {enhanceEntry,@@ -62,10 +61,8 @@ import {supportedMisc,generateImageThumbnail} from '-/services/thumbsgenerator';-import { defaultSettings } from '-/perspectives/grid-perspective';import { base64ToArrayBuffer } from '-/utils/dom';-import { Simulate } from 'react-dom/test-utils';-import error = Simulate.error;+import { Pro } from '-/pro';const supportedImgsWS = ['jpg',@@ -526,6 +523,9 @@ export function createDirectoryIndex(enableWS = true// disableIndexing = true,): Promise<Array<TS.FileSystemEntry>> {+ if (Pro && Pro.Watcher) {+ Pro.Watcher.stopWatching();+ }let directoryPath;let locationID;if (typeof param === 'object' && param !== null) {