mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 09:09:36 +02:00
Merge pull request #25740 from overleaf/dp-gutter-error-logs
Correctly open logs when using AI assist gutter button in new editor GitOrigin-RevId: 2700832f9e18d10ca3e6ee52841d31613fee626c
This commit is contained in:
@@ -50,6 +50,8 @@ import { isSplitTestEnabled } from '@/utils/splitTestUtils'
|
||||
import { captureException } from '@/infrastructure/error-reporter'
|
||||
import OError from '@overleaf/o-error'
|
||||
import getMeta from '@/utils/meta'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
import { useRailContext } from '@/features/ide-redesign/contexts/rail-context'
|
||||
|
||||
type PdfFile = Record<string, any>
|
||||
|
||||
@@ -125,6 +127,8 @@ export const LocalCompileProvider: FC<React.PropsWithChildren> = ({
|
||||
const { openDocWithId, openDocs, currentDocument } = useEditorManagerContext()
|
||||
const { role } = useDetachContext()
|
||||
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
|
||||
const {
|
||||
_id: projectId,
|
||||
rootDocId,
|
||||
@@ -135,6 +139,8 @@ export const LocalCompileProvider: FC<React.PropsWithChildren> = ({
|
||||
|
||||
const { pdfPreviewOpen } = useLayoutContext()
|
||||
|
||||
const { openTab: openRailTab } = useRailContext()
|
||||
|
||||
const { features, alphaProgram, labsProgram } = useUserContext()
|
||||
|
||||
const { fileTreeData } = useFileTreeData()
|
||||
@@ -742,8 +748,12 @@ export const LocalCompileProvider: FC<React.PropsWithChildren> = ({
|
||||
const lastCompileOptions = useMemo(() => data?.options || {}, [data])
|
||||
|
||||
useEffect(() => {
|
||||
const listener = (event: Event) => {
|
||||
setShowLogs((event as CustomEvent<boolean>).detail as boolean)
|
||||
const listener = () => {
|
||||
if (newEditor) {
|
||||
openRailTab('errors')
|
||||
} else {
|
||||
setShowLogs(true)
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('editor:show-logs', listener)
|
||||
@@ -751,7 +761,7 @@ export const LocalCompileProvider: FC<React.PropsWithChildren> = ({
|
||||
return () => {
|
||||
window.removeEventListener('editor:show-logs', listener)
|
||||
}
|
||||
}, [])
|
||||
}, [newEditor, openRailTab])
|
||||
|
||||
const value = useMemo(
|
||||
() => ({
|
||||
|
||||
Reference in New Issue
Block a user