From 95b373ed52bf9b54a5ffe44bed890bb14123b396 Mon Sep 17 00:00:00 2001 From: Davinder Singh Date: Fri, 31 Jul 2026 09:59:00 +0100 Subject: [PATCH] Merge pull request #36035 from overleaf/ds-unable-sync-modal-error [WEB] Adding error message in the unable to sync modal GitOrigin-RevId: b9d2cdc0db8c87e8f90b77d812dbb6d0c6695622 --- .../web/frontend/extracted-translations.json | 1 + .../modals/unable-to-sync-modal.tsx | 31 ++++++++++++++++++- services/web/locales/en.json | 1 + 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json index 17773224a6..2ff71755ff 100644 --- a/services/web/frontend/extracted-translations.json +++ b/services/web/frontend/extracted-translations.json @@ -2280,6 +2280,7 @@ "turn_off_link_sharing": "", "turn_on": "", "turn_on_link_sharing": "", + "unable_to_save_check_connection_or_download": "", "unarchive": "", "uncategorized": "", "uncategorized_projects": "", diff --git a/services/web/frontend/js/features/ide-react/components/modals/unable-to-sync-modal.tsx b/services/web/frontend/js/features/ide-react/components/modals/unable-to-sync-modal.tsx index c789eaabb0..541ba5989d 100644 --- a/services/web/frontend/js/features/ide-react/components/modals/unable-to-sync-modal.tsx +++ b/services/web/frontend/js/features/ide-react/components/modals/unable-to-sync-modal.tsx @@ -1,4 +1,4 @@ -import { useTranslation } from 'react-i18next' +import { Trans, useTranslation } from 'react-i18next' import { memo, useCallback, useState } from 'react' import OLButton from '@/shared/components/ol/ol-button' import { @@ -12,6 +12,8 @@ import DiffViewer from './diff-viewer' import getMeta from '@/utils/meta' import { uploadBatch } from '@/infrastructure/batch-file-uploader' import { debugConsole } from '@/utils/debugging' +import Notification from '@/shared/components/notification' +import { downloadFileContent } from '@/utils/download-file' export type UnableToSyncModalProps = { baseContent: string @@ -54,12 +56,18 @@ function UnableToSyncModal({ }: UnableToSyncModalProps) { const { t } = useTranslation() const [saving, setSaving] = useState(false) + const [saveError, setSaveError] = useState(false) + + const handleDownload = useCallback(() => { + downloadFileContent(targetContent, docName ?? 'document.txt') + }, [targetContent, docName]) const handleSaveAsNewFile = useCallback(async () => { const projectId = getMeta('ol-project_id') const filename = buildOfflineFilename(docName) setSaving(true) + setSaveError(false) try { if (!rootFolderId) { throw new Error('rootFolderId not available') @@ -79,6 +87,7 @@ function UnableToSyncModal({ onHide() } catch (error) { debugConsole.error('Failed to save offline changes as new file', error) + setSaveError(true) } finally { setSaving(false) } @@ -100,6 +109,26 @@ function UnableToSyncModal({

{t('offline_edits_couldnt_combine')}

{t('offline_save_explanation')}

+ {saveError && ( + { + e.preventDefault() + handleDownload() + }} + />, + ]} + /> + } + /> + )} diff --git a/services/web/locales/en.json b/services/web/locales/en.json index 47855ec7af..9c29567d76 100644 --- a/services/web/locales/en.json +++ b/services/web/locales/en.json @@ -2905,6 +2905,7 @@ "tutorials": "Tutorials", "uk": "Ukrainian", "unable_to_extract_the_supplied_zip_file": "Opening this content on Overleaf failed because the zip file could not be extracted. Please ensure that it is a valid zip file. If this keeps happening for links on a particular site, please report this to them.", + "unable_to_save_check_connection_or_download": "We couldn’t add this file to your project. Check your connection and try again, or <0>download the file instead.", "unarchive": "Restore", "uncategorized": "Uncategorized", "uncategorized_projects": "Uncategorized Projects",