@@ -235,21 +235,15 @@ export default function TreeViewsContainer() {
235
235
} ,
236
236
[ ]
237
237
) ;
238
- const handleCloseDirectoryMenu = useCallback (
239
- ( e : unknown , nextSelectedDirectoryId : string | null = null ) => {
240
- setOpenDirectoryMenu ( false ) ;
241
- dispatch ( setActiveDirectory ( undefined ) ) ;
242
- if ( nextSelectedDirectoryId !== null && treeDataRef . current ?. mapData ?. [ nextSelectedDirectoryId ] ) {
243
- dispatch ( setSelectedDirectory ( treeDataRef . current . mapData [ nextSelectedDirectoryId ] ) ) ;
244
- }
245
- // so it removes the style that we added ourselves
246
- if ( DOMFocusedDirectory !== null ) {
247
- ( DOMFocusedDirectory as HTMLElement ) . classList . remove ( 'focused' ) ;
248
- setDOMFocusedDirectory ( null ) ;
249
- }
250
- } ,
251
- [ DOMFocusedDirectory , dispatch ]
252
- ) ;
238
+ const handleCloseDirectoryMenu = useCallback ( ( ) => {
239
+ setOpenDirectoryMenu ( false ) ;
240
+ dispatch ( setActiveDirectory ( undefined ) ) ;
241
+ // so it removes the style that we added ourselves
242
+ if ( DOMFocusedDirectory !== null ) {
243
+ ( DOMFocusedDirectory as HTMLElement ) . classList . remove ( 'focused' ) ;
244
+ setDOMFocusedDirectory ( null ) ;
245
+ }
246
+ } , [ DOMFocusedDirectory , dispatch ] ) ;
253
247
254
248
/* Menu states */
255
249
const [ mousePosition , setMousePosition ] = useState < {
@@ -662,7 +656,7 @@ export default function TreeViewsContainer() {
662
656
const handleOnMouseDown = useCallback < NonNullable < BoxProps [ 'onMouseDown' ] > > (
663
657
( e ) => {
664
658
if ( e . button === constants . MOUSE_EVENT_RIGHT_BUTTON && openDialog === constants . DialogsId . NONE ) {
665
- handleCloseDirectoryMenu ( e , null ) ;
659
+ handleCloseDirectoryMenu ( ) ;
666
660
}
667
661
} ,
668
662
[ handleCloseDirectoryMenu , openDialog ]
@@ -696,7 +690,7 @@ export default function TreeViewsContainer() {
696
690
openDialog = { openDialog }
697
691
setOpenDialog = { setOpenDialog }
698
692
// TODO why doing a lambda loosing the 2nd parameter here?
699
- onClose = { ( e : unknown ) => handleCloseDirectoryMenu ( e , null ) }
693
+ onClose = { handleCloseDirectoryMenu }
700
694
anchorReference = { anchorReference }
701
695
anchorPosition = { anchorPosition }
702
696
anchorEl = { anchorEl }
0 commit comments