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 <[email protected]>
Цей коміт міститься в:
Isaac Gallartтаigallart authored and GitHub committed 2026-12-03 17:59:10 +08:00
1 джерело c3726daed6
коміт fc52975be0
1 file changed
+4 -1
+4 -1
Переглянути файл
@@ -320,6 +320,7 @@ export function formatFileDetails(entry: Pick<FileEntry, "size" | "mtimeMs"> | 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() {
) : (
<Row
node={node}
roots={roots}
label={fileLabel(node)}
matches={state.matches}
editing={editing}
@@ -1152,6 +1154,7 @@ export function ProjectView() {
/>
),
[
roots,
fileLabel,
editing,
cutPaths,