Merge pull request #35457 from overleaf/mj-more-disabled-buttons

[web] Disable compilation buttons during network stall

GitOrigin-RevId: c94a77fea7171c6e9ff4fa9f30e9475474900845
This commit is contained in:
Mathias Jakobsen
2026-09-17 11:28:24 +00:00
committed by Copybot
parent f86334750e
commit 6f06df61a6
7 changed files with 56 additions and 13 deletions
@@ -76,6 +76,7 @@ export const DetachCompileProvider: FC<React.PropsWithChildren> = ({
darkModePdf: _darkModePdf,
setDarkModePdf: _setDarkModePdf,
activeOverallTheme: _activeOverallTheme,
isNetworkStalled: _isNetworkStalled,
} = localCompileContext
const [animateCompileDropdownArrow] = useDetachStateWatcher(
@@ -410,7 +411,14 @@ export const DetachCompileProvider: FC<React.PropsWithChildren> = ({
'detached'
)
useCompileTriggers(startCompile, setChangedAt)
const [isNetworkStalled] = useDetachStateWatcher(
'isNetworkStalled',
_isNetworkStalled,
'detacher',
'detached'
)
useCompileTriggers(startCompile, setChangedAt, isNetworkStalled)
useLogEvents(setShowLogs)
const value = useMemo(
@@ -473,6 +481,7 @@ export const DetachCompileProvider: FC<React.PropsWithChildren> = ({
darkModePdf,
setDarkModePdf,
activeOverallTheme,
isNetworkStalled,
}),
[
animateCompileDropdownArrow,
@@ -531,6 +540,7 @@ export const DetachCompileProvider: FC<React.PropsWithChildren> = ({
darkModePdf,
setDarkModePdf,
activeOverallTheme,
isNetworkStalled,
]
)
@@ -60,6 +60,7 @@ import {
ActiveOverallTheme,
useActiveOverallTheme,
} from '../hooks/use-active-overall-theme'
import useIsNetworkStalled from '@/features/ide-react/hooks/use-is-network-stalled'
type PdfFile = Record<string, any>
@@ -132,6 +133,7 @@ export type CompileContext = {
darkModePdf: boolean | undefined
setDarkModePdf: (value: boolean) => void
activeOverallTheme: ActiveOverallTheme
isNetworkStalled: boolean
}
export const LocalCompileContext = createContext<CompileContext | undefined>(
@@ -156,6 +158,7 @@ export const LocalCompileProvider: FC<React.PropsWithChildren> = ({
const { fileTreeData } = useFileTreeData()
const { findEntityByPath } = useFileTreePathContext()
const getRootDocInfo = useRootDoc()
const isNetworkStalled = useIsNetworkStalled()
// whether a compile is in progress
const [compiling, setCompiling] = useState(false)
@@ -822,6 +825,7 @@ export const LocalCompileProvider: FC<React.PropsWithChildren> = ({
darkModePdf,
setDarkModePdf,
activeOverallTheme,
isNetworkStalled,
}),
[
animateCompileDropdownArrow,
@@ -879,6 +883,7 @@ export const LocalCompileProvider: FC<React.PropsWithChildren> = ({
darkModePdf,
setDarkModePdf,
activeOverallTheme,
isNetworkStalled,
]
)