mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-03 12:52:39 +02:00
feat(sidebar): implement canonicalize roots, authoritative mount handling & preserved incremental UX for local folder mode
This commit is contained in:
parent
dbdeaa1bcf
commit
95511f0915
5 changed files with 98 additions and 22 deletions
|
|
@ -150,6 +150,13 @@ export function LocalFilesystemBrowser({
|
|||
setMountByRootKey(new Map());
|
||||
return;
|
||||
}
|
||||
if (rootPaths.length === 0) {
|
||||
setMountByRootKey(new Map());
|
||||
setMountStatus("complete");
|
||||
setMountRefreshInFlight(false);
|
||||
hasLoadedMountsOnceRef.current = true;
|
||||
return;
|
||||
}
|
||||
let cancelled = false;
|
||||
const isInitialMountLoad = !hasLoadedMountsOnceRef.current;
|
||||
if (isInitialMountLoad) {
|
||||
|
|
@ -161,13 +168,9 @@ export function LocalFilesystemBrowser({
|
|||
.getAgentFilesystemMounts()
|
||||
.then((mounts: LocalRootMount[]) => {
|
||||
if (cancelled) return;
|
||||
const knownRootKeys = new Set(
|
||||
rootPaths.map((rootPath) => normalizeRootPathForLookup(rootPath, isWindowsPlatform))
|
||||
);
|
||||
const next = new Map<string, string>();
|
||||
for (const entry of mounts) {
|
||||
const normalizedRootKey = normalizeRootPathForLookup(entry.rootPath, isWindowsPlatform);
|
||||
if (!knownRootKeys.has(normalizedRootKey)) continue;
|
||||
next.set(normalizedRootKey, entry.mount);
|
||||
}
|
||||
setMountByRootKey(next);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue