refactor(sidebar): streamline DocumentsSidebar and FolderTreeView for improved performance

- Removed unnecessary filtering logic in FolderTreeView to simplify document rendering.
- Updated DocumentsSidebar to eliminate redundant props and enhance layout consistency.
- Adjusted Sidebar component to conditionally render DocumentsSidebar based on the documentsPanel state.
This commit is contained in:
Anish Sarkar 2026-07-06 12:49:41 +05:30
parent 53259b6105
commit e24abd7eac
5 changed files with 102 additions and 890 deletions

View file

@ -260,16 +260,6 @@ export function FolderTreeView({
const nodes: React.ReactNode[] = [];
if (parentId === null) {
const processingDocs = childDocs.filter((d) => {
const state = d.status?.state;
return state === "pending" || state === "processing";
});
for (const d of processingDocs) {
nodes.push(renderDocumentNode(d, depth));
}
}
for (let i = 0; i < visibleFolders.length; i++) {
const f = visibleFolders[i];
const siblingPositions = {
@ -314,15 +304,7 @@ export function FolderTreeView({
}
}
const remainingDocs =
parentId === null
? childDocs.filter((d) => {
const state = d.status?.state;
return state !== "pending" && state !== "processing";
})
: childDocs;
for (const d of remainingDocs) {
for (const d of childDocs) {
nodes.push(renderDocumentNode(d, depth));
}