Skip to content

Commit

Permalink
Don't list-prs-for-file while you're editing the same PR (#3935)
Browse files Browse the repository at this point in the history
  • Loading branch information
yakov116 committed Feb 5, 2021
1 parent 71975fa commit a069714
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions source/features/list-prs-for-file.tsx
Expand Up @@ -96,8 +96,14 @@ const getPrsByFile = cache.function(async (): Promise<Record<string, number[]>>
async function init(): Promise<void> {
// `clipboard-copy` on blob page, `#blob-edit-path` on edit page
const path = select('clipboard-copy, #blob-edit-path')!.getAttribute('value')!;
const {[path]: prs} = await getPrsByFile();
if (!prs) {
let {[path]: prs} = await getPrsByFile();

const editingPRNumber = new URLSearchParams(location.search).get('pr')?.split('/').slice(-1);
if (prs && editingPRNumber) {
prs = prs.filter(pr => pr !== Number(editingPRNumber));
}

if (prs.length === 0) {
return;
}

Expand Down

0 comments on commit a069714

Please sign in to comment.