@@ -10,13 +10,17 @@ import 'tippy.js/dist/tippy.css';
1010import { DirectoryOptionsActions } from 'constants/WorkspaceDirectory' ;
1111import ConfirmActionModal from 'components/molecules/modals/ConfirmActionModal' ;
1212import { deleteFlowTest } from 'service/collection' ;
13+ import useCollectionStore from 'stores/CollectionStore' ;
1314
1415const Collection = ( { collectionId, item, depth } ) => {
15- const [ isExpanded , setIsExpanded ] = useState ( false ) ;
16+ //const [isExpanded, setIsExpanded] = useState(false);
17+ const clickItem = useCollectionStore ( ( state ) => state . clickItem ) ;
1618 const [ confirmActionModalOpen , setConfirmActionModalOpen ] = useState ( false ) ;
1719 const [ flowTestPathToDelete , setFlowTestPathToDelete ] = useState ( '' ) ;
20+
1821 const messageForConfirmActionModal =
1922 'Do you wish to delete this flowtest? This action deletes it from disk and cannot be undone' ;
23+
2024 const getListDisplayTitle = ( ) => {
2125 if ( item . type === OBJ_TYPES . collection ) {
2226 // this is for collections tab thus we have archive box icon
@@ -27,7 +31,8 @@ const Collection = ({ collectionId, item, depth }) => {
2731 const clickFromElementDataSet = event . target . dataset ;
2832 const clickFrom = clickFromElementDataSet ?. clickFrom ;
2933 if ( ! clickFrom || clickFrom !== 'options-menu' ) {
30- return setIsExpanded ( ( prev ) => ! prev ) ;
34+ clickItem ( item , collectionId ) ;
35+ //return setIsExpanded((prev) => !prev);
3136 }
3237 } }
3338 >
@@ -90,7 +95,8 @@ const Collection = ({ collectionId, item, depth }) => {
9095 onClick = { ( event ) => {
9196 const clickFrom = event . target . dataset ?. clickFrom ;
9297 if ( ! clickFrom || clickFrom !== 'options-menu' ) {
93- return setIsExpanded ( ( prev ) => ! prev ) ;
98+ clickItem ( item , collectionId ) ;
99+ //return setIsExpanded((prev) => !prev);
94100 }
95101 } }
96102 >
@@ -113,7 +119,7 @@ const Collection = ({ collectionId, item, depth }) => {
113119 < >
114120 < li >
115121 { getListDisplayTitle ( ) }
116- { isExpanded && (
122+ { item . collapsed === false && (
117123 < >
118124 { item . items ?. map ( ( childItem , index ) => (
119125 < ul
0 commit comments