feat: improve Obsidian connector visibility and desktop sync flow

This commit is contained in:
Oscar Zhou 2026-04-14 19:07:14 +09:30
parent e1e4bb4706
commit 204dac2c3a
4 changed files with 45 additions and 7 deletions

View file

@ -14,6 +14,10 @@ import { deleteDocumentMutationAtom } from "@/atoms/documents/document-mutation.
import { expandedFolderIdsAtom } from "@/atoms/documents/folder.atoms";
import { agentCreatedDocumentsAtom } from "@/atoms/documents/ui.atoms";
import { openEditorPanelAtom } from "@/atoms/editor/editor-panel.atom";
import {
folderWatchDialogOpenAtom,
folderWatchInitialFolderAtom,
} from "@/atoms/folder-sync/folder-sync.atoms";
import { rightPanelCollapsedAtom } from "@/atoms/layout/right-panel.atom";
import { CreateFolderDialog } from "@/components/documents/CreateFolderDialog";
import type { DocumentNodeDoc } from "@/components/documents/DocumentNode";
@ -104,8 +108,8 @@ export function DocumentsSidebar({
const debouncedSearch = useDebouncedValue(search, 250);
const [activeTypes, setActiveTypes] = useState<DocumentTypeEnum[]>([]);
const [watchedFolderIds, setWatchedFolderIds] = useState<Set<number>>(new Set());
const [folderWatchOpen, setFolderWatchOpen] = useState(false);
const [watchInitialFolder, setWatchInitialFolder] = useState<SelectedFolder | null>(null);
const [folderWatchOpen, setFolderWatchOpen] = useAtom(folderWatchDialogOpenAtom);
const [watchInitialFolder, setWatchInitialFolder] = useAtom(folderWatchInitialFolderAtom);
const isElectron = typeof window !== "undefined" && !!window.electronAPI;
const handleWatchLocalFolder = useCallback(async () => {
@ -118,7 +122,8 @@ export function DocumentsSidebar({
const folderName = folderPath.split("/").pop() || folderPath.split("\\").pop() || folderPath;
setWatchInitialFolder({ path: folderPath, name: folderName });
setFolderWatchOpen(true);
}, []);
}, [setWatchInitialFolder, setFolderWatchOpen]);
const refreshWatchedIds = useCallback(async () => {
if (!electronAPI?.getWatchedFolders) return;