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 (
{sortedItems.map((item, index) => { - const isCut = clipboard?.operation === 'cut' && - clipboard.items?.some(clipItem => clipItem.path === item.path); + // ⚡ Bolt Performance Optimization: + // O(1) Set lookups instead of O(M) Array.some() searches for every single item + const isSelected = selectedPaths.has(item.path); + const isCut = cutPaths.has(item.path); return ( selected.path === item.path)} + isSelected={isSelected} isFocused={focusedItem && focusedItem.path === item.path} - isCut={!!isCut} + isCut={isCut} onItemClick={stableOnItemClick} onItemDoubleClick={stableOnItemDoubleClick} /> From 9add53cd00c70dde08ad5cfdc736f0904ca971fc 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:42:27 +0000 Subject: [PATCH 2/2] Fix test compile failure caused by missing macro import Added `use crate::log_info;` to tests mod in `src-tauri/src/commands/volume_operations_commands.rs` to fix macro resolution during cargo test. Co-authored-by: TheerasakPing <185220419+TheerasakPing@users.noreply.github.com> --- src-tauri/src/commands/volume_operations_commands.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src-tauri/src/commands/volume_operations_commands.rs b/src-tauri/src/commands/volume_operations_commands.rs index 6fd3acb8..af74e75f 100644 --- a/src-tauri/src/commands/volume_operations_commands.rs +++ b/src-tauri/src/commands/volume_operations_commands.rs @@ -137,6 +137,7 @@ pub fn get_system_volumes_information() -> Vec { #[cfg(test)] mod tests { use super::*; + use crate::log_info; #[test] fn test_get_volumes() {