From 9ea7659f61a787c49cc32a9696267f840ea0ce41 Mon Sep 17 00:00:00 2001 From: sanish chirayath Date: Tue, 22 Jul 2025 12:51:41 +0530 Subject: [PATCH] fix: crash double-click handling for collection and collection item (#5151) --- .../Sidebar/Collections/Collection/CollectionItem/index.js | 7 +++++++ .../src/components/Sidebar/Collections/Collection/index.js | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js index a20de70ea..e7a3a21ea 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js @@ -217,6 +217,12 @@ const CollectionItem = ({ item, collectionUid, collectionPathname, searchText }) ); }; + // prevent the parent's double-click handler from firing + const handleFolderDoubleClick = (e) => { + e.stopPropagation(); + e.preventDefault(); + }; + const handleRightClick = (event) => { const _menuDropdown = dropdownTippyRef.current; if (_menuDropdown) { @@ -358,6 +364,7 @@ const CollectionItem = ({ item, collectionUid, collectionPathname, searchText }) className={iconClassName} style={{ color: 'rgb(160 160 160)' }} onClick={handleFolderCollapse} + onDoubleClick={handleFolderDoubleClick} /> ) : null} diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/index.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/index.js index 404258d8d..4b787fc3d 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/index.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/index.js @@ -111,6 +111,12 @@ const Collection = ({ collection, searchText }) => { dispatch(toggleCollection(collection.uid)); } + // prevent the parent's double-click handler from firing + const handleCollectionDoubleClick = (e) => { + e.stopPropagation(); + e.preventDefault(); + }; + const handleRightClick = (event) => { const _menuDropdown = menuDropdownTippyRef.current; if (_menuDropdown) { @@ -223,6 +229,7 @@ const Collection = ({ collection, searchText }) => { className={`chevron-icon ${iconClassName}`} style={{ width: 16, minWidth: 16, color: 'rgb(160 160 160)' }} onClick={handleCollectionCollapse} + onDoubleClick={handleCollectionDoubleClick} />