From c90233c01f4bc1a3fcaff459ae26ee0173560489 Mon Sep 17 00:00:00 2001 From: Alexandre Bourdin Date: Tue, 29 Jul 2025 10:10:03 +0200 Subject: [PATCH] Merge pull request #27303 from overleaf/dp-go-to-code Hide go to code button in the new editor logs when it does nothing GitOrigin-RevId: f08c3fc98bae8116a428a7528291edccd6d4f8c0 --- .../components/error-logs/log-entry-header.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/services/web/frontend/js/features/ide-redesign/components/error-logs/log-entry-header.tsx b/services/web/frontend/js/features/ide-redesign/components/error-logs/log-entry-header.tsx index 3b4c9f6347..bb99fc90bd 100644 --- a/services/web/frontend/js/features/ide-redesign/components/error-logs/log-entry-header.tsx +++ b/services/web/frontend/js/features/ide-redesign/components/error-logs/log-entry-header.tsx @@ -11,6 +11,8 @@ import useResizeObserver from '@/features/preview/hooks/use-resize-observer' import OLIconButton from '@/features/ui/components/ol/ol-icon-button' import importOverleafModules from '../../../../../macros/import-overleaf-module.macro' import MaterialIcon from '@/shared/components/material-icon' +import { useFileTreePathContext } from '@/features/file-tree/contexts/file-tree-path' +import { useFileTreeOpenContext } from '@/features/ide-react/context/file-tree-open-context' const actionComponents = importOverleafModules( 'pdfLogEntryHeaderActionComponents' @@ -49,6 +51,8 @@ function LogEntryHeader({ const { t } = useTranslation() const logLocationSpanRef = useRef(null) const [locationSpanOverflown, setLocationSpanOverflown] = useState(false) + const { findEntityByPath } = useFileTreePathContext() + const { openEntity } = useFileTreeOpenContext() useResizeObserver( logLocationSpanRef, @@ -95,6 +99,11 @@ function LogEntryHeader({ ) : null const headerTitleText = logType ? `${logType} ${headerTitle}` : headerTitle + const fileData = file && findEntityByPath(file) + const showGoToCodeButton = + showSourceLocationLink && + !!fileData && + !(fileData.entity._id === openEntity?.entity._id && !line) return (
@@ -136,7 +145,7 @@ function LogEntryHeader({ {actionButtonsOverride ?? (
- {showSourceLocationLink && ( + {showGoToCodeButton && (