review error
This commit is contained in:
Vendored
+9
-9
@@ -81,23 +81,23 @@ function reviewImages(v) {
|
||||
return h("figure", {}, h("a", { href: src, target: "_blank", rel: "noopener" }, h("img", { src, alt: caption || "screenshot", loading: "lazy" })), caption ? h("figcaption", {}, caption) : null);
|
||||
}));
|
||||
}
|
||||
const stepChanges = new Map();
|
||||
const stepPatches = new Map();
|
||||
const snapChanges = new Map();
|
||||
const snapPatches = new Map();
|
||||
function snapshotPatch(taskId, n, path) {
|
||||
const key = `${taskId}/${n}/${path}`;
|
||||
const cached = stepPatches.get(key);
|
||||
const cached = snapPatches.get(key);
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
const fetched = (async () => {
|
||||
const ck = `${taskId}/${n}`;
|
||||
let pending = stepChanges.get(ck);
|
||||
let pending = snapChanges.get(ck);
|
||||
if (!pending) {
|
||||
pending = get("/api/tasks/{taskId}/changes", { path: { taskId }, query: { snapshot: n, step: true } });
|
||||
stepChanges.set(ck, pending);
|
||||
pending = get("/api/tasks/{taskId}/changes", { path: { taskId }, query: { snapshot: n } });
|
||||
snapChanges.set(ck, pending);
|
||||
}
|
||||
const changes = await pending.catch((err) => {
|
||||
stepChanges.delete(ck);
|
||||
snapChanges.delete(ck);
|
||||
throw err;
|
||||
});
|
||||
const f = changes.files.find((c) => c.path === path);
|
||||
@@ -107,8 +107,8 @@ function snapshotPatch(taskId, n, path) {
|
||||
const d = await get("/api/tasks/{taskId}/diff", { path: { taskId }, query: { base: changes.base, tree: changes.tree, path: f.path, old_path: f.old_path } });
|
||||
return d.patch;
|
||||
})();
|
||||
stepPatches.set(key, fetched);
|
||||
fetched.catch(() => stepPatches.delete(key));
|
||||
snapPatches.set(key, fetched);
|
||||
fetched.catch(() => snapPatches.delete(key));
|
||||
return fetched;
|
||||
}
|
||||
function linesAround(patch, line, end) {
|
||||
|
||||
Reference in New Issue
Block a user