From 36fae7c8eac2ef4dfdd304da5a726c1eab72c818 Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Tue, 9 Aug 2022 14:49:27 +0100 Subject: [PATCH] Merge pull request #8961 from overleaf/ae-prevent-compile-on-load Allow "compile on load" to be disabled (for tests) GitOrigin-RevId: f36b4a5c10c4bd68832e27d6472346f77afdb9c2 --- .../web/frontend/js/features/pdf-preview/util/compiler.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/web/frontend/js/features/pdf-preview/util/compiler.js b/services/web/frontend/js/features/pdf-preview/util/compiler.js index 78aa38e32c..28c175053d 100644 --- a/services/web/frontend/js/features/pdf-preview/util/compiler.js +++ b/services/web/frontend/js/features/pdf-preview/util/compiler.js @@ -65,6 +65,10 @@ export default class DocumentCompiler { async compile(options = {}) { options = { ...this.defaultOptions, ...options } + if (options.isAutoCompileOnLoad && getMeta('ol-preventCompileOnLoad')) { + return + } + // set "compiling" to true (in the React component's state), and return if it was already true const wasCompiling = this.compilingRef.current this.setCompiling(true)