Merge pull request #4207 from overleaf/bg-reset-service-worker

add setting to reset service worker

GitOrigin-RevId: da889e43f99c908eee1b2351f69571b4bccde28d
This commit is contained in:
Jakob Ackermann 2021-06-16 10:14:32 +02:00 committed by Copybot
parent e8bb0114f8
commit 3414646290
4 changed files with 12 additions and 2 deletions

View file

@ -894,6 +894,7 @@ const ProjectController = {
), ),
trackPdfDownload: partOfPdfCachingRollout('collect-metrics'), trackPdfDownload: partOfPdfCachingRollout('collect-metrics'),
enablePdfCaching: partOfPdfCachingRollout('enable-caching'), enablePdfCaching: partOfPdfCachingRollout('enable-caching'),
resetServiceWorker: Boolean(Settings.resetServiceWorker),
}) })
timer.done() timer.done()
} }

View file

@ -188,6 +188,7 @@ block append meta
meta(name="ol-showSymbolPalette" data-type="boolean" content=showSymbolPalette) meta(name="ol-showSymbolPalette" data-type="boolean" content=showSymbolPalette)
meta(name="ol-enablePdfCaching" data-type="boolean" content=enablePdfCaching) meta(name="ol-enablePdfCaching" data-type="boolean" content=enablePdfCaching)
meta(name="ol-trackPdfDownload" data-type="boolean" content=trackPdfDownload) meta(name="ol-trackPdfDownload" data-type="boolean" content=trackPdfDownload)
meta(name="ol-resetServiceWorker" data-type="boolean" content=resetServiceWorker)
- var fileActionI18n = ['edited', 'renamed', 'created', 'deleted'].reduce((acc, i) => {acc[i] = translate('file_action_' + i); return acc}, {}) - var fileActionI18n = ['edited', 'renamed', 'created', 'deleted'].reduce((acc, i) => {acc[i] = translate('file_action_' + i); return acc}, {})
meta(name="ol-fileActionI18n" data-type="json" content=fileActionI18n) meta(name="ol-fileActionI18n" data-type="json" content=fileActionI18n)

View file

@ -673,6 +673,9 @@ module.exports = {
// By default turn on feature flag, can be overridden per request. // By default turn on feature flag, can be overridden per request.
enablePdfCaching: process.env.ENABLE_PDF_CACHING === 'true', enablePdfCaching: process.env.ENABLE_PDF_CACHING === 'true',
// Whether to disable any existing service worker on the next load of the editor
resetServiceWorker: process.env.RESET_SERVICE_WORKER === 'true',
// Maximum size of text documents in the real-time editing system. // Maximum size of text documents in the real-time editing system.
max_doc_length: 2 * 1024 * 1024, // 2mb max_doc_length: 2 * 1024 * 1024, // 2mb

View file

@ -32,7 +32,10 @@ import MetadataManager from './ide/metadata/MetadataManager'
import ReviewPanelManager from './ide/review-panel/ReviewPanelManager' import ReviewPanelManager from './ide/review-panel/ReviewPanelManager'
import OutlineManager from './features/outline/outline-manager' import OutlineManager from './features/outline/outline-manager'
import SafariScrollPatcher from './ide/SafariScrollPatcher' import SafariScrollPatcher from './ide/SafariScrollPatcher'
import { loadServiceWorker } from './ide/pdfng/directives/serviceWorkerManager' import {
loadServiceWorker,
unregisterServiceWorker,
} from './ide/pdfng/directives/serviceWorkerManager'
import './ide/cobranding/CobrandingDataService' import './ide/cobranding/CobrandingDataService'
import './ide/settings/index' import './ide/settings/index'
import './ide/chat/index' import './ide/chat/index'
@ -363,7 +366,9 @@ If the project has been renamed please look in your project list for a new proje
} }
) )
if (getMeta('ol-enablePdfCaching')) { if (getMeta('ol-resetServiceWorker')) {
unregisterServiceWorker()
} else if (getMeta('ol-enablePdfCaching')) {
loadServiceWorker() loadServiceWorker()
} }