Merge pull request #31924 from overleaf/ds-removing-useIsNewEditorEnabled-4

[Part 4] Removing the usage of `useIsNewEditorEnabled` for editor tear down

GitOrigin-RevId: 4c1194bb011630f83ecf7334f9ad0deb6ab52580
This commit is contained in:
Davinder Singh
2026-03-06 09:15:39 +00:00
committed by Copybot
parent 05acd6b769
commit d023f721b7
10 changed files with 31 additions and 324 deletions
@@ -1,18 +1,13 @@
import { memo } from 'react'
import PreviewLogEntryHeader from '../../preview/components/preview-log-entry-header'
import PdfLogEntryContent from './pdf-log-entry-content'
import HumanReadableLogsHints from '../../../ide/human-readable-logs/HumanReadableLogsHints'
import getMeta from '@/utils/meta'
import { ErrorLevel, LogEntry, SourceLocation } from '../util/types'
import NewLogEntry from '@/features/pdf-preview/components/log-entry'
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
import useHandleLogEntryClick from '../hooks/use-handle-log-entry-click'
function PdfLogEntry({
autoExpand,
ruleId,
headerTitle,
headerIcon,
rawContent,
logType,
formattedContent,
@@ -31,7 +26,6 @@ function PdfLogEntry({
level: ErrorLevel
autoExpand?: boolean
ruleId?: string
headerIcon?: React.ReactElement
rawContent?: string
logType?: string
formattedContent?: React.ReactNode
@@ -45,8 +39,6 @@ function PdfLogEntry({
logEntry?: LogEntry
id?: string
}) {
const showAiErrorAssistant = getMeta('ol-showAiFeatures')
if (ruleId && HumanReadableLogsHints[ruleId]) {
const hint = HumanReadableLogsHints[ruleId]
formattedContent = hint.formattedContent(contentDetails)
@@ -60,58 +52,25 @@ function PdfLogEntry({
onSourceLocationClick,
})
const newEditor = useIsNewEditorEnabled()
if (newEditor) {
return (
<NewLogEntry
autoExpand={autoExpand}
index={index}
id={id}
logEntry={logEntry}
ruleId={ruleId}
headerTitle={headerTitle}
formattedContent={formattedContent}
rawContent={rawContent}
logType={logType}
level={level}
contentDetails={contentDetails}
entryAriaLabel={entryAriaLabel}
sourceLocation={sourceLocation}
onSourceLocationClick={handleLogEntryLinkClick}
showSourceLocationLink={showSourceLocationLink}
extraInfoURL={extraInfoURL}
/>
)
}
return (
<div
className="log-entry"
aria-label={entryAriaLabel}
data-ruleid={ruleId}
data-log-entry-id={id}
>
<PreviewLogEntryHeader
level={level}
sourceLocation={sourceLocation}
headerTitle={headerTitle}
headerIcon={headerIcon}
logType={logType}
showSourceLocationLink={showSourceLocationLink}
onSourceLocationClick={handleLogEntryLinkClick}
/>
{(rawContent || formattedContent || showAiErrorAssistant) && (
<PdfLogEntryContent
rawContent={rawContent}
formattedContent={formattedContent}
extraInfoURL={extraInfoURL}
index={index}
logEntry={logEntry}
/>
)}
</div>
<NewLogEntry
autoExpand={autoExpand}
index={index}
id={id}
logEntry={logEntry}
ruleId={ruleId}
headerTitle={headerTitle}
formattedContent={formattedContent}
rawContent={rawContent}
logType={logType}
level={level}
contentDetails={contentDetails}
entryAriaLabel={entryAriaLabel}
sourceLocation={sourceLocation}
onSourceLocationClick={handleLogEntryLinkClick}
showSourceLocationLink={showSourceLocationLink}
extraInfoURL={extraInfoURL}
/>
)
}
@@ -256,12 +256,10 @@ export default memo(PdfPreviewError)
function ErrorLogEntry({
autoExpand = true,
title,
headerIcon,
children,
}: {
autoExpand?: boolean
title: string
headerIcon?: React.ReactElement
children: React.ReactNode
}) {
const { t } = useTranslation()
@@ -270,7 +268,6 @@ function ErrorLogEntry({
<PdfLogEntry
autoExpand={autoExpand}
headerTitle={title}
headerIcon={headerIcon}
formattedContent={children}
entryAriaLabel={t('compile_error_entry_description')}
level="error"