Skip to content

Commit eb1e56f

Browse files
authored
Fix TreeViewsContainer => remove unused code (#539)
Signed-off-by: capyq <[email protected]>
1 parent 4e93e13 commit eb1e56f

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

src/components/tree-views-container.tsx

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -235,21 +235,15 @@ export default function TreeViewsContainer() {
235235
},
236236
[]
237237
);
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]);
253247

254248
/* Menu states */
255249
const [mousePosition, setMousePosition] = useState<{
@@ -662,7 +656,7 @@ export default function TreeViewsContainer() {
662656
const handleOnMouseDown = useCallback<NonNullable<BoxProps['onMouseDown']>>(
663657
(e) => {
664658
if (e.button === constants.MOUSE_EVENT_RIGHT_BUTTON && openDialog === constants.DialogsId.NONE) {
665-
handleCloseDirectoryMenu(e, null);
659+
handleCloseDirectoryMenu();
666660
}
667661
},
668662
[handleCloseDirectoryMenu, openDialog]
@@ -696,7 +690,7 @@ export default function TreeViewsContainer() {
696690
openDialog={openDialog}
697691
setOpenDialog={setOpenDialog}
698692
// TODO why doing a lambda loosing the 2nd parameter here?
699-
onClose={(e: unknown) => handleCloseDirectoryMenu(e, null)}
693+
onClose={handleCloseDirectoryMenu}
700694
anchorReference={anchorReference}
701695
anchorPosition={anchorPosition}
702696
anchorEl={anchorEl}

0 commit comments

Comments
 (0)