Show disabled "merged" button when PR merged

This commit is contained in:
Mattias Granlund 2024-02-04 21:19:07 +01:00
parent 28efb148ae
commit 34b10fae7d
No known key found for this signature in database

View File

@ -233,22 +233,28 @@
{#if prStatus?.success}
<Button
help="Merge pull request and refresh"
disabled={isUnapplied}
disabled={isUnapplied || !$pr$}
loading={isMerging}
on:click={async () => {
isMerging = true;
try {
if ($pr$) await githubService.merge($pr$.number);
branchService.reloadVirtualBranches();
fetchPrStatus();
if ($pr$) {
await githubService.merge($pr$.number);
}
} catch {
toasts.error('Failed to merge pull request');
} finally {
isMerging = false;
await fetchPrStatus();
await branchService.reloadVirtualBranches();
}
}}
>
Merge
{#if $pr$}
Merge
{:else}
Merged
{/if}
</Button>
{/if}
</div>