Przeglądaj źródła

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

[web] fix compile from history for old projects

GitOrigin-RevId: d46dc3bbcd60dd6d7d74809e0b4e2619b7bd9b49
Andrew Rumble 7 miesięcy temu
rodzic
commit
10e24ab074

+ 1 - 1
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)) {

+ 10 - 0
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,
   },
 }