Skip to content

Commit dd6e1be

Browse files
committed
Move await for GitHub content to allow meta return early
1 parent 40f2250 commit dd6e1be

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

web/src/lib/diff-viewer-multi-file.svelte.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ export class MultiFileDiffViewerState {
527527
},
528528
async () => {
529529
const result = await resultPromise;
530-
return parseMultiFilePatchGithub(result.info, result.response);
530+
return parseMultiFilePatchGithub(result.info, await result.response);
531531
},
532532
);
533533
}

web/src/lib/github.svelte.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export type GithubDiff = {
2222

2323
export type GithubDiffResult = {
2424
info: GithubDiff;
25-
response: string;
25+
response: Promise<string>;
2626
};
2727

2828
if (browser) {
@@ -176,7 +176,7 @@ export async function fetchGithubComparison(
176176
url = `https://github.com/${owner}/${repo}/compare/${base}...${head}`;
177177
}
178178
const info = { owner, repo, base, head, description, backlink: url };
179-
return { response: await response.text(), info };
179+
return { response: response.text(), info };
180180
} else {
181181
throw Error(`Failed to retrieve comparison (${response.status}): ${await response.text()}`);
182182
}
@@ -207,7 +207,7 @@ export async function fetchGithubCommitDiff(token: string | null, owner: string,
207207
const description = `${meta.commit.message.split("\n")[0]} (${trimCommitHash(commit)})`;
208208
const info = { owner, repo, base: firstParent, head: commit, description, backlink: meta.html_url };
209209
return {
210-
response: await response.text(),
210+
response: response.text(),
211211
info,
212212
};
213213
} else {

0 commit comments

Comments
 (0)