From b98ea7e940f3a43c3d43718fe648a20f95f4ff7a Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 9 Mar 2026 11:29:40 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9A=A1=20Bolt:=20[performance=20improvem?= =?UTF-8?q?ent]=20Optimize=20FileList.jsx=20render=20loop=20complexity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactor O(N*M) array iteration lookups into O(N) Set lookups during render loop. Co-authored-by: TheerasakPing <185220419+TheerasakPing@users.noreply.github.com> --- .jules/bolt.md | 0 pnpm-workspace.yaml | 2 ++ src/components/explorer/FileList.jsx | 19 +++++++++++++++---- 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 .jules/bolt.md create mode 100644 pnpm-workspace.yaml diff --git a/.jules/bolt.md b/.jules/bolt.md new file mode 100644 index 00000000..e69de29b diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 00000000..c5739b74 --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +ignoredBuiltDependencies: + - esbuild diff --git a/src/components/explorer/FileList.jsx b/src/components/explorer/FileList.jsx index c6b37acb..24374754 100644 --- a/src/components/explorer/FileList.jsx +++ b/src/components/explorer/FileList.jsx @@ -579,6 +579,15 @@ const FileList = ({ data, isLoading, viewMode = 'grid', isSearching = false, sea handleItemClickRef.current(item, index, true); }, []); + // ⚡ Bolt Performance Optimization: + // Create Sets for O(1) lookups during render instead of O(M) Array.some() checks + // This reduces the render loop complexity from O(N*M) to O(N) where N is sortedItems length + const selectedPaths = useMemo(() => new Set(selectedItems.map(item => item.path)), [selectedItems]); + const cutPaths = useMemo(() => { + if (clipboard?.operation !== 'cut' || !clipboard?.items) return new Set(); + return new Set(clipboard.items.map(item => item.path)); + }, [clipboard]); + return (