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