overleaf/services/web/frontend/js/features/ide-react/hooks/use-has-linting-error.ts
Tim Down 1c820de200 Merge pull request #15610 from overleaf/td-ide-page-editor-events
React IDE page: hook up events

GitOrigin-RevId: 1121a30755fc600023f06925ca3eafa7a8e1ee14
2023-11-14 09:04:36 +00:00

12 lines
455 B
TypeScript

import useEventListener from '@/shared/hooks/use-event-listener'
import { useLocalCompileContext } from '@/shared/context/local-compile-context'
export function useHasLintingError() {
const { setHasLintingError } = useLocalCompileContext()
// Listen for editor:lint event from CM6 linter and keep compile context
// up to date
useEventListener('editor:lint', (event: CustomEvent) => {
setHasLintingError(event.detail.hasLintingError)
})
}