Skip to content

Commit

Permalink
fix: handle errors and avoid loop in canMergeAll check
Browse files Browse the repository at this point in the history
  • Loading branch information
ndom91 committed Dec 5, 2024
1 parent 394fff3 commit 7fcaed9
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions apps/desktop/src/lib/branch/SeriesHeader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@
lastPush: Date | undefined;
}
const { branch, isTopBranch: isTopSeries, isBottomBranch: isBottomSeries, lastPush }: Props = $props();
const {
branch,
isTopBranch: isTopSeries,
isBottomBranch: isBottomSeries,
lastPush
}: Props = $props();
let descriptionVisible = $state(!!branch.description);
Expand Down Expand Up @@ -79,7 +84,7 @@
let kebabContextMenuTrigger = $state<HTMLButtonElement>();
let seriesHeaderEl = $state<HTMLDivElement>();
let seriesDescriptionEl = $state<HTMLTextAreaElement>();
let targetBaseError = $state<Error | undefined>();
let contextMenuOpened = $state(false);
const topPatch = $derived(branch?.patches[0]);
Expand Down Expand Up @@ -177,12 +182,19 @@
$prService &&
$forge?.name === 'github' &&
branch.prNumber &&
!targetBaseError &&
$pr?.state === 'open'
) {
$prService?.update(branch.prNumber, { targetBase }).then(async () => {
await $forgeListing?.refresh();
await updateStatusAndChecks();
});
$prService
?.update(branch.prNumber, { targetBase })
.then(async () => {
await $forgeListing?.refresh();
await updateStatusAndChecks();
})
.catch((err) => {
showError('Failed to update PR target base', err.message ? err.message : err);
targetBaseError = err;
});
}
});
Expand Down

0 comments on commit 7fcaed9

Please sign in to comment.