Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Reduce API

Manav Rathi9a6f3133b1bd
diff --git a/web/apps/photos/src/components/WatchFolder.tsx b/web/apps/photos/src/components/WatchFolder.tsx
index 8001dd9920..b5ff00b291 100644
--- a/web/apps/photos/src/components/WatchFolder.tsx
+++ b/web/apps/photos/src/components/WatchFolder.tsx
@@ -111,9 +111,10 @@ export const WatchFolder: React.FC<WatchFolderProps> = ({ open, onClose }) => {
setMappings(await watchFolderService.getWatchMappings());
};
- const handleRemoveWatchMapping = async (mapping: WatchMapping) => {
- await watchFolderService.removeWatchMapping(mapping.folderPath);
- setMappings(await watchFolderService.getWatchMappings());
+ const handleRemoveWatchMapping = (mapping: WatchMapping) => {
+ watchFolderService
+ .mappingsAfterRemovingFolder(mapping.folderPath)
+ .then((ms) => setMappings(ms));
};
const closeChoiceModal = () => setChoiceModalOpen(false);
diff --git a/web/apps/photos/src/services/watch.ts b/web/apps/photos/src/services/watch.ts
index 1c26addf09..2d5ef02287 100644
--- a/web/apps/photos/src/services/watch.ts
+++ b/web/apps/photos/src/services/watch.ts
@@ -1,3 +1,8 @@
+/**
+ * @file Interface with the Node.js layer of our desktop app to provide the
+ * watch folders functionality.
+ */
+
import { ensureElectron } from "@/next/electron";
import log from "@/next/log";
import { UPLOAD_RESULT, UPLOAD_STRATEGY } from "constants/upload";
@@ -190,12 +195,9 @@ class WatchFolderService {
}
}
- async removeWatchMapping(folderPath: string) {
- try {
- await ensureElectron().removeWatchMapping(folderPath);
- } catch (e) {
- log.error("error while removing watch mapping", e);
- }
+ async mappingsAfterRemovingFolder(folderPath: string) {
+ await ensureElectron().removeWatchMapping(folderPath);
+ return await this.getWatchMappings();
}
async getWatchMappings(): Promise<WatchMapping[]> {