Skip to content

Commit 7fcaed9

Browse files
committed
fix: handle errors and avoid loop in canMergeAll check
1 parent 394fff3 commit 7fcaed9

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

apps/desktop/src/lib/branch/SeriesHeader.svelte

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@
4242
lastPush: Date | undefined;
4343
}
4444
45-
const { branch, isTopBranch: isTopSeries, isBottomBranch: isBottomSeries, lastPush }: Props = $props();
45+
const {
46+
branch,
47+
isTopBranch: isTopSeries,
48+
isBottomBranch: isBottomSeries,
49+
lastPush
50+
}: Props = $props();
4651
4752
let descriptionVisible = $state(!!branch.description);
4853
@@ -79,7 +84,7 @@
7984
let kebabContextMenuTrigger = $state<HTMLButtonElement>();
8085
let seriesHeaderEl = $state<HTMLDivElement>();
8186
let seriesDescriptionEl = $state<HTMLTextAreaElement>();
82-
87+
let targetBaseError = $state<Error | undefined>();
8388
let contextMenuOpened = $state(false);
8489
8590
const topPatch = $derived(branch?.patches[0]);
@@ -177,12 +182,19 @@
177182
$prService &&
178183
$forge?.name === 'github' &&
179184
branch.prNumber &&
185+
!targetBaseError &&
180186
$pr?.state === 'open'
181187
) {
182-
$prService?.update(branch.prNumber, { targetBase }).then(async () => {
183-
await $forgeListing?.refresh();
184-
await updateStatusAndChecks();
185-
});
188+
$prService
189+
?.update(branch.prNumber, { targetBase })
190+
.then(async () => {
191+
await $forgeListing?.refresh();
192+
await updateStatusAndChecks();
193+
})
194+
.catch((err) => {
195+
showError('Failed to update PR target base', err.message ? err.message : err);
196+
targetBaseError = err;
197+
});
186198
}
187199
});
188200

0 commit comments

Comments
 (0)