diff --git a/services/web/frontend/js/features/pdf-preview/util/output-files.js b/services/web/frontend/js/features/pdf-preview/util/output-files.js index 80edb05658..6825ddc12e 100644 --- a/services/web/frontend/js/features/pdf-preview/util/output-files.js +++ b/services/web/frontend/js/features/pdf-preview/util/output-files.js @@ -5,7 +5,7 @@ import { v4 as uuid } from 'uuid' const searchParams = new URLSearchParams(window.location.search) -export const handleOutputFiles = async (outputFiles, projectId, data) => { +export function handleOutputFiles(outputFiles, projectId, data) { const result = {} const pdfDownloadDomain = data.pdfDownloadDomain ?? '' diff --git a/services/web/frontend/js/shared/context/local-compile-context.js b/services/web/frontend/js/shared/context/local-compile-context.js index 56642e6411..f406ed42ce 100644 --- a/services/web/frontend/js/shared/context/local-compile-context.js +++ b/services/web/frontend/js/shared/context/local-compile-context.js @@ -247,49 +247,48 @@ export function LocalCompileProvider({ children }) { } // set the PDF URLs - handleOutputFiles(outputFiles, projectId, data).then(result => { - if (data.status === 'success') { - setPdfDownloadUrl(result.pdfDownloadUrl) - setPdfUrl(result.pdfUrl) - } + const result = handleOutputFiles(outputFiles, projectId, data) + if (data.status === 'success') { + setPdfDownloadUrl(result.pdfDownloadUrl) + setPdfUrl(result.pdfUrl) + } - setFileList( - buildFileList(outputFiles, data.clsiServerId, data.compileGroup) - ) + setFileList( + buildFileList(outputFiles, data.clsiServerId, data.compileGroup) + ) - // handle log files - // asynchronous (TODO: cancel on new compile?) - setLogEntryAnnotations(null) - setLogEntries(null) - setRawLog(null) + // handle log files + // asynchronous (TODO: cancel on new compile?) + setLogEntryAnnotations(null) + setLogEntries(null) + setRawLog(null) - handleLogFiles(outputFiles, data, abortController.signal).then( - result => { - setRawLog(result.log) - setLogEntries(result.logEntries) - setLogEntryAnnotations( - buildLogEntryAnnotations( - result.logEntries.all, - ide.fileTreeManager - ) + handleLogFiles(outputFiles, data, abortController.signal).then( + result => { + setRawLog(result.log) + setLogEntries(result.logEntries) + setLogEntryAnnotations( + buildLogEntryAnnotations( + result.logEntries.all, + ide.fileTreeManager ) + ) - // sample compile stats for real users - if (!window.user.alphaProgram && data.status === 'success') { - sendMBSampled( - 'compile-result', - { - errors: result.logEntries.errors.length, - warnings: result.logEntries.warnings.length, - typesetting: result.logEntries.typesetting.length, - newPdfPreview: true, // TODO: is this useful? - }, - 0.01 - ) - } + // sample compile stats for real users + if (!window.user.alphaProgram && data.status === 'success') { + sendMBSampled( + 'compile-result', + { + errors: result.logEntries.errors.length, + warnings: result.logEntries.warnings.length, + typesetting: result.logEntries.typesetting.length, + newPdfPreview: true, // TODO: is this useful? + }, + 0.01 + ) } - ) - }) + } + ) } switch (data.status) {