|
@@ -1,9 +1,21 @@
|
|
|
-import { FC } from 'react'
|
|
|
|
|
|
|
+import { FC, useEffect } from 'react'
|
|
|
import { useTranslation } from 'react-i18next'
|
|
import { useTranslation } from 'react-i18next'
|
|
|
import OLNotification from '@/features/ui/components/ol/ol-notification'
|
|
import OLNotification from '@/features/ui/components/ol/ol-notification'
|
|
|
|
|
+import { useEditorManagerContext } from '@/features/ide-react/context/editor-manager-context'
|
|
|
|
|
+import { useIdeReactContext } from '@/features/ide-react/context/ide-react-context'
|
|
|
|
|
|
|
|
export const UnsavedDocsLockedAlert: FC = () => {
|
|
export const UnsavedDocsLockedAlert: FC = () => {
|
|
|
const { t } = useTranslation()
|
|
const { t } = useTranslation()
|
|
|
|
|
+ const { openDocs } = useEditorManagerContext()
|
|
|
|
|
+ const { reportError } = useIdeReactContext()
|
|
|
|
|
+
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ const { pendingOpsLength, inflightOpsLength } = openDocs.getUnsavedOpsSize()
|
|
|
|
|
+ reportError('connection-lost-with-unsaved-changes', {
|
|
|
|
|
+ pendingOpsLength,
|
|
|
|
|
+ inflightOpsLength,
|
|
|
|
|
+ })
|
|
|
|
|
+ }, [reportError, openDocs])
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<OLNotification
|
|
<OLNotification
|