From fc52975be0699d834faf4300ee9ad5ea4bdcbaec Mon Sep 17 00:00:00 2001 From: Isaac Gallart Date: Thu, 3 Dec 2026 10:59:10 +0100 Subject: [PATCH] fix(project-tree): reuse effective roots across rows (#7739) Every newly mounted Project row rebuilt the effective root list, which stalled scrollbar drags in workspaces with thousands of detected roots. ProjectView already computes that list for the tree; it now passes it to the rows, so their icons use the same roots without rebuilding it while scrolling. Co-authored-by: igallart <13520529+igallart@users.noreply.github.com> --- src/features/project-tree/ProjectView.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/features/project-tree/ProjectView.tsx b/src/features/project-tree/ProjectView.tsx index c9b912cbd..b269e7940 100644 --- a/src/features/project-tree/ProjectView.tsx +++ b/src/features/project-tree/ProjectView.tsx @@ -320,6 +320,7 @@ export function formatFileDetails(entry: Pick | n interface RowProps { node: ProjectNode; + roots: readonly RootFolder[]; label: string; matches: number[] | null; editing: Editing | null; @@ -340,6 +341,7 @@ const holdsOpenFile = (dir: string, files: readonly string[]) => const Row = memo(function Row({ node, + roots, label, matches, editing, @@ -356,7 +358,6 @@ const Row = memo(function Row({ // Memoised: redraw this row itself when the file icon theme changes. useFileIconRevision(); const deco = useFileDecoration(node.path); - const roots = useEffectiveRoots(); const root = useProjectTree((s) => s.root); const detected = useDetectedRoots(); const build = useProjectPresentation(); @@ -1133,6 +1134,7 @@ export function ProjectView() { ) : ( ), [ + roots, fileLabel, editing, cutPaths,