From a0c180d1332019d8e2789304f8009f03b145d3b4 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Tue, 25 Oct 2022 16:39:26 +0100 Subject: [PATCH] Merge pull request #10156 from overleaf/jpa-web-disable-prefetch [web] pdf-caching: double down on disabling of prefetching GitOrigin-RevId: 60ccea883786bad306a747b5a182982bc648bbbd --- services/web/frontend/js/features/pdf-preview/util/metrics.js | 2 +- .../web/frontend/js/features/pdf-preview/util/pdf-caching.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/services/web/frontend/js/features/pdf-preview/util/metrics.js b/services/web/frontend/js/features/pdf-preview/util/metrics.js index 5839a43146..21e37508f2 100644 --- a/services/web/frontend/js/features/pdf-preview/util/metrics.js +++ b/services/web/frontend/js/features/pdf-preview/util/metrics.js @@ -4,7 +4,7 @@ import { trackPdfDownloadEnabled } from './pdf-caching-flags' // VERSION should get incremented when making changes to caching behavior or // adjusting metrics collection. -const VERSION = 7 +const VERSION = 8 // editing session id const EDITOR_SESSION_ID = uuid() diff --git a/services/web/frontend/js/features/pdf-preview/util/pdf-caching.js b/services/web/frontend/js/features/pdf-preview/util/pdf-caching.js index 04b1dde434..d4a88cde94 100644 --- a/services/web/frontend/js/features/pdf-preview/util/pdf-caching.js +++ b/services/web/frontend/js/features/pdf-preview/util/pdf-caching.js @@ -648,7 +648,8 @@ export async function fetchRange({ preprocessFileOnce({ file, usageScore, cachedUrls }) const startXRefTableRange = Math.floor(file.startXRefTable / PDF_JS_CHUNK_SIZE) * PDF_JS_CHUNK_SIZE - const prefetchXRefTable = startXRefTableRange > 0 && start === 0 + const prefetchXRefTable = + prefetchingEnabled && startXRefTableRange > 0 && start === 0 const prefetched = getMatchingChunks(file.prefetched, start, end) // Check that handling the range request won't trigger excessive sub-requests,