diff --git a/apps/desktop/src/lib/pr/MergeButton.svelte b/apps/desktop/src/lib/pr/MergeButton.svelte index b8150cb481..9a9b704622 100644 --- a/apps/desktop/src/lib/pr/MergeButton.svelte +++ b/apps/desktop/src/lib/pr/MergeButton.svelte @@ -4,20 +4,30 @@ import { MergeMethod } from '$lib/forge/interface/types'; import DropDownButton from '$lib/shared/DropDownButton.svelte'; import { persisted, type Persisted } from '@gitbutler/shared/persisted'; - import { createEventDispatcher } from 'svelte'; - export let projectId: string; - export let loading = false; - export let disabled = false; - export let wide = false; - export let tooltip = ''; + interface Props { + projectId: string; + loading?: boolean; + disabled?: boolean; + wide?: boolean; + tooltip?: string; + onclick?: (method: MergeMethod) => void; + } + + const { + projectId, + loading = false, + disabled = false, + wide = false, + tooltip = '', + onclick + }: Props = $props(); function persistedAction(projectId: string): Persisted { const key = 'projectMergeMethod'; return persisted(MergeMethod.Merge, key + projectId); } - const dispatch = createEventDispatcher<{ click: { method: MergeMethod } }>(); const action = persistedAction(projectId); let dropDown: ReturnType | undefined; @@ -30,16 +40,14 @@ onclick?.($action)} style="ghost" outline {loading} - bind:this={dropDown} {wide} {tooltip} {disabled} - onclick={() => { - dispatch('click', { method: $action }); - }} > {labels[$action]} {#snippet contextMenuSlot()} diff --git a/apps/desktop/src/lib/pr/PullRequestCard.svelte b/apps/desktop/src/lib/pr/PullRequestCard.svelte index 41e27384ca..28a249cc0e 100644 --- a/apps/desktop/src/lib/pr/PullRequestCard.svelte +++ b/apps/desktop/src/lib/pr/PullRequestCard.svelte @@ -311,10 +311,9 @@ disabled={mergeStatus.disabled} tooltip={mergeStatus.tooltip} loading={isMerging} - on:click={async (e) => { + onclick={async (method) => { if (!pr) return; isMerging = true; - const method = e.detail.method; try { await $prService?.merge(method, pr.number); await baseBranchService.fetchFromRemotes();