mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Add event when the connection lost modal is shown for users who have internet, but doc saves aren't successful (#25960)
* adding naive event send for case where realtime is disconnected, but user has internet connection for events * using reportError and moving ops length summation to getUnsavedOpsSize GitOrigin-RevId: 7c1c8e31ddbaa21fbc299703c69cf07ab46df925
This commit is contained in:
committed by
Copybot
parent
d7b282c176
commit
dcd73f16a6
+13
-1
@@ -1,9 +1,21 @@
|
||||
import { FC } from 'react'
|
||||
import { FC, useEffect } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
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 = () => {
|
||||
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 (
|
||||
<OLNotification
|
||||
|
||||
Reference in New Issue
Block a user