From 620f31d6a6900e4739b3b1605af1a1ce5927df49 Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Thu, 17 Oct 2024 14:29:13 +0100 Subject: [PATCH] Restore singleton pdfCachingTransportFactory (#21194) GitOrigin-RevId: 3c1d71ba4fdd07f0774534fbe3a99b2d47dfa962 --- .../frontend/js/features/pdf-preview/util/pdf-js-wrapper.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/web/frontend/js/features/pdf-preview/util/pdf-js-wrapper.ts b/services/web/frontend/js/features/pdf-preview/util/pdf-js-wrapper.ts index c5c57a52ae..40df51f073 100644 --- a/services/web/frontend/js/features/pdf-preview/util/pdf-js-wrapper.ts +++ b/services/web/frontend/js/features/pdf-preview/util/pdf-js-wrapper.ts @@ -18,6 +18,7 @@ export default class PDFJSWrapper { public readonly viewer: PDFViewer public readonly eventBus: EventBus private readonly linkService: PDFLinkService + private readonly pdfCachingTransportFactory: any // eslint-disable-next-line no-useless-constructor constructor(public container: HTMLDivElement) { @@ -43,6 +44,8 @@ export default class PDFJSWrapper { }) this.linkService.setViewer(this.viewer) + + this.pdfCachingTransportFactory = generatePdfCachingTransportFactory() } // load a document from a URL @@ -64,7 +67,7 @@ export default class PDFJSWrapper { } return new Promise((resolve, reject) => { - const rangeTransport = generatePdfCachingTransportFactory()({ + const rangeTransport = this.pdfCachingTransportFactory({ url, pdfFile, abortController,