feat: enhance error handling in local folder indexing by adding rollback and refresh on IntegrityError

This commit is contained in:
Anish Sarkar 2026-04-03 09:29:59 +05:30
parent 9a65163fe4
commit e2ba509314
5 changed files with 27 additions and 10 deletions

View file

@ -358,6 +358,14 @@ export function DocumentsSidebar({
const handleDeleteFolder = useCallback(async (folder: FolderDisplay) => {
if (!confirm(`Delete folder "${folder.name}" and all its contents?`)) return;
try {
const api = window.electronAPI;
if (api) {
const watchedFolders = await api.getWatchedFolders();
const matched = watchedFolders.find((wf) => wf.rootFolderId === folder.id);
if (matched) {
await api.removeWatchedFolder(matched.path);
}
}
await foldersApiService.deleteFolder(folder.id);
toast.success("Folder deleted");
} catch (e: unknown) {