Просмотр исходного кода

Merge pull request #10156 from overleaf/jpa-web-disable-prefetch

[web] pdf-caching: double down on disabling of prefetching

GitOrigin-RevId: 60ccea883786bad306a747b5a182982bc648bbbd
Jakob Ackermann 4 лет назад
Родитель
Сommit
a0c180d133

+ 1 - 1
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()

+ 2 - 1
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,