mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 01:06:23 +02:00
feat: enhance folder indexing with metadata management and improve folder structure handling in UI components
This commit is contained in:
parent
60eb1e4060
commit
ae98f64760
6 changed files with 35 additions and 3 deletions
|
|
@ -168,6 +168,12 @@ export function FolderTreeView({
|
|||
return states;
|
||||
}, [folders, docsByFolder, foldersByParent, mentionedDocIds]);
|
||||
|
||||
const folderMap = useMemo(() => {
|
||||
const map: Record<number, FolderDisplay> = {};
|
||||
for (const f of folders) map[f.id] = f;
|
||||
return map;
|
||||
}, [folders]);
|
||||
|
||||
const folderProcessingStates = useMemo(() => {
|
||||
const states: Record<number, "idle" | "processing" | "failed"> = {};
|
||||
|
||||
|
|
@ -178,6 +184,11 @@ export function FolderTreeView({
|
|||
);
|
||||
let hasFailed = directDocs.some((d) => d.status?.state === "failed");
|
||||
|
||||
const folder = folderMap[folderId];
|
||||
if (folder?.metadata?.indexing_in_progress) {
|
||||
hasProcessing = true;
|
||||
}
|
||||
|
||||
for (const child of foldersByParent[folderId] ?? []) {
|
||||
const sub = compute(child.id);
|
||||
hasProcessing = hasProcessing || sub.hasProcessing;
|
||||
|
|
@ -195,7 +206,7 @@ export function FolderTreeView({
|
|||
if (states[f.id] === undefined) compute(f.id);
|
||||
}
|
||||
return states;
|
||||
}, [folders, docsByFolder, foldersByParent]);
|
||||
}, [folders, docsByFolder, foldersByParent, folderMap]);
|
||||
|
||||
function renderLevel(parentId: number | null, depth: number): React.ReactNode[] {
|
||||
const key = parentId ?? "root";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue