Skip to content

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

minor fixes

sytolkce25982dc3e3
diff --git a/src/main/mainEvents.ts b/src/main/mainEvents.ts
index ebc671897..dd4d71e5e 100644
--- a/src/main/mainEvents.ts
+++ b/src/main/mainEvents.ts
@@ -25,7 +25,7 @@ import path from 'path';
import chokidar, { FSWatcher } from 'chokidar';
import { isWorkerAvailable, postRequest, readMacOSTags } from './util';
-let watcher: FSWatcher = undefined;
+let watcher: FSWatcher;
export default function loadMainEvents() {
ipcMain.handle('isWorkerAvailable', async () => {
diff --git a/src/renderer/hooks/FSWatcherContextProvider.tsx b/src/renderer/hooks/FSWatcherContextProvider.tsx
index e993a8fbd..ad2a46398 100644
--- a/src/renderer/hooks/FSWatcherContextProvider.tsx
+++ b/src/renderer/hooks/FSWatcherContextProvider.tsx
@@ -87,14 +87,16 @@ export const FSWatcherContextProvider = ({
currentLocation.watchForChanges &&
currentLocation.type !== locationType.TYPE_CLOUD
) {
- const depth =
- currentDirectoryPerspective === PerspectiveIDs.KANBAN ? 3 : 1;
+ if (currentLocationPath.length > 0) {
+ const depth =
+ currentDirectoryPerspective === PerspectiveIDs.KANBAN ? 3 : 1;
- watchFolder(currentLocationPath, depth);
+ watchFolder(currentLocationPath, depth);
+ }
} else {
stopWatching();
}
- }, [currentLocation]);
+ }, [currentLocation, currentLocationPath]);
useEffect(() => {
// watchForEvents(listener);