Merge pull request #8009 from overleaf/jpa-sync-pdf-url-update

[web] update clsiServerId and pdfUrl in the same update cycle

GitOrigin-RevId: 6791627c12c16aa71ad393edbf19d7fed00491a0
This commit is contained in:
Alf Eaton 2022-05-18 11:37:25 +01:00 committed by Copybot
parent 5a5436d38f
commit a3459a1842
2 changed files with 37 additions and 38 deletions

View file

@ -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 ?? ''

View file

@ -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) {