diff --git a/services/web/frontend/js/features/preview/components/preview-logs-pane-entry.js b/services/web/frontend/js/features/preview/components/preview-logs-pane-entry.js index 6060a0e5d8..eb5fb47e26 100644 --- a/services/web/frontend/js/features/preview/components/preview-logs-pane-entry.js +++ b/services/web/frontend/js/features/preview/components/preview-logs-pane-entry.js @@ -67,12 +67,12 @@ function PreviewLogEntryHeader({ }) { const { t } = useTranslation() const logLocationSpanRef = useRef() - const [showLocationTooltip, setShowLocationTooltip] = useState(false) + const [locationSpanOverflown, setLocationSpanOverflown] = useState(false) useResizeObserver( logLocationSpanRef, - showLocationTooltip, - setTooltipForLogLocationLinkIfNeeded + locationSpanOverflown, + checkLocationSpanOverflow ) const file = sourceLocation ? sourceLocation.file : null @@ -95,10 +95,10 @@ function PreviewLogEntryHeader({ location: file + (line ? `, ${line}` : ''), }) - function setTooltipForLogLocationLinkIfNeeded(observedElement) { + function checkLocationSpanOverflow(observedElement) { const spanEl = observedElement.target - const shouldShowTooltip = spanEl.scrollWidth > spanEl.clientWidth - setShowLocationTooltip(shouldShowTooltip) + const isOverflowing = spanEl.scrollWidth > spanEl.clientWidth + setLocationSpanOverflown(isOverflowing) } const locationLinkText = @@ -132,11 +132,12 @@ function PreviewLogEntryHeader({ ) : null - const locationTooltip = showLocationTooltip ? ( - - {locationLinkText} - - ) : null + const locationTooltip = + locationSpanOverflown && locationLinkText ? ( + + {locationLinkText} + + ) : null var headerTitleText = logType ? `${logType} ${headerTitle}` : headerTitle @@ -146,7 +147,7 @@ function PreviewLogEntryHeader({
{headerIcon}
) : null}

{headerTitleText}

- {showLocationTooltip ? ( + {locationTooltip ? ( {locationLink} diff --git a/services/web/frontend/js/features/preview/components/preview-logs-pane.js b/services/web/frontend/js/features/preview/components/preview-logs-pane.js index 60e801ff6e..828231b411 100644 --- a/services/web/frontend/js/features/preview/components/preview-logs-pane.js +++ b/services/web/frontend/js/features/preview/components/preview-logs-pane.js @@ -23,6 +23,7 @@ function PreviewLogsPane({ onClearCache, }) { const { t } = useTranslation() + const nowTS = Date.now() const { all: allCompilerIssues = [], errors: compilerErrors = [], @@ -31,26 +32,25 @@ function PreviewLogsPane({ } = logEntries const errorsUI = Object.keys(errors).map((name, index) => ( - + )) const validationIssuesUI = Object.keys( validationIssues ).map((name, index) => ( )) - const logEntriesUI = [ ...compilerErrors, ...compilerWarnings, ...compilerTypesettingIssues, - ].map((logEntry, idx) => ( + ].map((logEntry, index) => (