Merge pull request #31971 from overleaf/jpa-fix-compile-old-projects

[web] fix compile from history for old projects

GitOrigin-RevId: d46dc3bbcd60dd6d7d74809e0b4e2619b7bd9b49
This commit is contained in:
Andrew Rumble
2026-03-03 14:35:15 +00:00
committed by Copybot
parent a7b4fdde9c
commit 10e24ab074
2 changed files with 11 additions and 1 deletions
@@ -894,7 +894,7 @@ async function _buildRequestFromHistoryFull(
history: { snapshot: rawSnapshot, changes: rawChanges },
startVersion,
},
} = await HistoryManager.promises.getLatestHistory(historyId)
} = await HistoryManager.promises.getLatestHistoryWithHistoryId(historyId)
const rawChangeOperations = _rawChangeOperationsFromChanges(rawChanges)
const globalBlobs = _collectGlobalBlobs(rawChangeOperations)
for (const { hash, rangesHash } of Object.values(rawSnapshot.files)) {
@@ -273,6 +273,15 @@ async function getContentAtVersion(projectId, version) {
async function getLatestHistory(projectId) {
const historyId = await getHistoryId(projectId)
return await getLatestHistoryWithHistoryId(historyId)
}
/**
* Get the latest chunk from history using already resolved historyId
*
* @param {string} historyId
*/
async function getLatestHistoryWithHistoryId(historyId) {
return await fetchJson(
`${HISTORY_V1_URL}/projects/${historyId}/latest/history`,
{
@@ -442,5 +451,6 @@ export default {
getChanges,
getProjectBlobStats,
getBlobStats,
getLatestHistoryWithHistoryId,
},
}