diff --git a/services/web/frontend/js/features/ide-react/hooks/use-open-file.ts b/services/web/frontend/js/features/ide-react/hooks/use-open-file.ts index 9ddd4055c5..6aaefb0ad9 100644 --- a/services/web/frontend/js/features/ide-react/hooks/use-open-file.ts +++ b/services/web/frontend/js/features/ide-react/hooks/use-open-file.ts @@ -6,16 +6,16 @@ import { findInTree } from '@/features/file-tree/util/find-in-tree' export function useOpenFile() { const ide = useIdeContext() - const { fileTreeData, setSelectedEntities } = useFileTreeData() + const { fileTreeData } = useFileTreeData() const openFileWithId = useCallback( (id: string) => { const result = findInTree(fileTreeData, id) if (result?.type === 'fileRef') { - setSelectedEntities(result) + window.dispatchEvent(new CustomEvent('editor.openDoc', { detail: id })) } }, - [fileTreeData, setSelectedEntities] + [fileTreeData] ) // Expose BinaryFilesManager via ide object solely for the benefit of the file diff --git a/services/web/frontend/js/features/ide-react/hooks/use-select-file-tree-entity.ts b/services/web/frontend/js/features/ide-react/hooks/use-select-file-tree-entity.ts index 966e024a6e..babc788618 100644 --- a/services/web/frontend/js/features/ide-react/hooks/use-select-file-tree-entity.ts +++ b/services/web/frontend/js/features/ide-react/hooks/use-select-file-tree-entity.ts @@ -3,8 +3,7 @@ import { useCallback } from 'react' import { findInTree } from '@/features/file-tree/util/find-in-tree' export function useSelectFileTreeEntity() { - const { fileTreeData, selectedEntities, setSelectedEntities } = - useFileTreeData() + const { fileTreeData, selectedEntities } = useFileTreeData() const selectEntity = useCallback( id => { @@ -16,10 +15,10 @@ export function useSelectFileTreeEntity() { } const entityToSelect = findInTree(fileTreeData, id) if (entityToSelect) { - setSelectedEntities([entityToSelect]) + window.dispatchEvent(new CustomEvent('editor.openDoc', { detail: id })) } }, - [fileTreeData, selectedEntities, setSelectedEntities] + [fileTreeData, selectedEntities] ) return { selectEntity }