From 10e24ab0749a585b4cb4c68213d01bbee39fc516 Mon Sep 17 00:00:00 2001 From: Andrew Rumble Date: Tue, 3 Mar 2026 14:35:15 +0000 Subject: [PATCH] Merge pull request #31971 from overleaf/jpa-fix-compile-old-projects [web] fix compile from history for old projects GitOrigin-RevId: d46dc3bbcd60dd6d7d74809e0b4e2619b7bd9b49 --- services/web/app/src/Features/Compile/ClsiManager.mjs | 2 +- .../web/app/src/Features/History/HistoryManager.mjs | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/services/web/app/src/Features/Compile/ClsiManager.mjs b/services/web/app/src/Features/Compile/ClsiManager.mjs index 5813167152..85b377fa03 100644 --- a/services/web/app/src/Features/Compile/ClsiManager.mjs +++ b/services/web/app/src/Features/Compile/ClsiManager.mjs @@ -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)) { diff --git a/services/web/app/src/Features/History/HistoryManager.mjs b/services/web/app/src/Features/History/HistoryManager.mjs index a1f6bde69e..8874a5a5c2 100644 --- a/services/web/app/src/Features/History/HistoryManager.mjs +++ b/services/web/app/src/Features/History/HistoryManager.mjs @@ -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, }, }