mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-31 21:01:33 +02:00
Merge pull request #28599 from overleaf/mj-stop-deselecting-error-tabs
[web] Avoid hiding logs when downloading file GitOrigin-RevId: 596d93a4b2ac57bcbfaf50f0e4359b72f25e4861
This commit is contained in:
committed by
Copybot
parent
b5149591d1
commit
283abeef37
@@ -1,5 +1,5 @@
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { ElementType, memo, useMemo, useState } from 'react'
|
||||
import { ElementType, memo, useCallback, useMemo, useState } from 'react'
|
||||
import { usePdfPreviewContext } from '@/features/pdf-preview/components/pdf-preview-provider'
|
||||
import StopOnFirstErrorPrompt from '@/features/pdf-preview/components/stop-on-first-error-prompt'
|
||||
import PdfPreviewError from '@/features/pdf-preview/components/pdf-preview-error'
|
||||
@@ -57,6 +57,15 @@ function ErrorLogs({
|
||||
|
||||
const [activeTab, setActiveTab] = useState<string | null>('all')
|
||||
|
||||
const changeTab = useCallback(
|
||||
(key: string | null) => {
|
||||
if (tabs.some(tab => tab.key === key)) {
|
||||
setActiveTab(key)
|
||||
}
|
||||
},
|
||||
[tabs]
|
||||
)
|
||||
|
||||
const entries = useMemo(() => {
|
||||
return tabs.find(tab => tab.key === activeTab)?.entries || []
|
||||
}, [activeTab, tabs])
|
||||
@@ -65,7 +74,7 @@ function ErrorLogs({
|
||||
const includeWarnings = activeTab === 'all' || activeTab === 'warnings'
|
||||
|
||||
return (
|
||||
<TabContainer onSelect={setActiveTab} defaultActiveKey={activeTab ?? 'all'}>
|
||||
<TabContainer onSelect={changeTab} defaultActiveKey={activeTab ?? 'all'}>
|
||||
<Nav defaultActiveKey="all" className="error-logs-tabs">
|
||||
{tabs.map(tab => (
|
||||
<TabHeader key={tab.key} tab={tab} active={activeTab === tab.key} />
|
||||
|
||||
Reference in New Issue
Block a user