From af302b7c2f524e71ab22a0e849cfae71fca631bc Mon Sep 17 00:00:00 2001 From: Mathias Jakobsen Date: Fri, 5 Sep 2025 11:02:49 +0100 Subject: [PATCH] Merge pull request #28290 from overleaf/mj-outline-hide-when-last-file-deleted [web] Hide project outline when no file is selected GitOrigin-RevId: 0fa5b54c63e3b545f4382a48a40823f0dfea23a4 --- .../js/features/ide-react/context/outline-context.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/web/frontend/js/features/ide-react/context/outline-context.tsx b/services/web/frontend/js/features/ide-react/context/outline-context.tsx index 05409cf075..f69250a332 100644 --- a/services/web/frontend/js/features/ide-react/context/outline-context.tsx +++ b/services/web/frontend/js/features/ide-react/context/outline-context.tsx @@ -15,6 +15,7 @@ import { isValidTeXFile } from '@/main/is-valid-tex-file' import localStorage from '@/infrastructure/local-storage' import { useProjectContext } from '@/shared/context/project-context' import { useEditorOpenDocContext } from '@/features/ide-react/context/editor-open-doc-context' +import { useFileTreeOpenContext } from './file-tree-open-context' export type PartialFlatOutline = { level: number @@ -126,6 +127,9 @@ export const OutlineProvider: FC = ({ children }) => { [openDocName] ) + const { selectedEntityCount } = useFileTreeOpenContext() + const hasSingleEntityOpen = selectedEntityCount === 1 + const { projectId } = useProjectContext() const storageKey = `file_outline.expanded.${projectId}` @@ -133,7 +137,7 @@ export const OutlineProvider: FC = ({ children }) => { () => localStorage.getItem(storageKey) !== false ) - const canShowOutline = isTexFile && !binaryFileOpened + const canShowOutline = hasSingleEntityOpen && isTexFile && !binaryFileOpened const expandOutline = useCallback(() => { if (canShowOutline) {