Skip to content

Commit

Permalink
Fix draft preference for creating PRs
Browse files Browse the repository at this point in the history
- regressed in previous refactor
  • Loading branch information
mtsgrd committed Nov 8, 2024
1 parent 7837811 commit 008d44c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 68 deletions.
12 changes: 5 additions & 7 deletions apps/desktop/src/lib/pr/PrDetailsModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<script lang="ts">
import PrDetailsModalHeader from './PrDetailsModalHeader.svelte';
import PrTemplateSection from './PrTemplateSection.svelte';
import { getPreferredPRAction, PRAction } from './pr';
import { AIService } from '$lib/ai/service';
import { Project } from '$lib/backend/projects';
import { TemplateService } from '$lib/backend/templateService';
Expand Down Expand Up @@ -74,7 +73,6 @@
const aiGenEnabled = projectAiGenEnabled(project.id);
const forge = getForge();
const templateService = getContext(TemplateService);
const preferredPRAction = getPreferredPRAction();
const branch = $derived($branchStore);
const branchName = $derived(
Expand All @@ -89,7 +87,7 @@
const baseBranchName = $derived($baseBranch.shortName);
let createPrDropDown = $state<ReturnType<typeof DropDownButton>>();
let isDraft = $state<boolean>($preferredPRAction === PRAction.CreateDraft);
const createDraft = persisted<boolean>(false, 'createDraftPr');
let modal = $state<ReturnType<typeof Modal>>();
let templateSelector = $state<ReturnType<typeof PrTemplateSection>>();
Expand Down Expand Up @@ -232,7 +230,7 @@
await createPr({
title: actualTitle,
body: actualBody,
draft: isDraft
draft: $createDraft
});
close();
}
Expand Down Expand Up @@ -470,21 +468,21 @@
onclick={async () => await handleCreatePR(close)}
>
{pushBeforeCreate ? 'Push and ' : ''}
{isDraft ? 'Create pull request draft' : `Create pull request`}
{$createDraft ? 'Create pull request draft' : `Create pull request`}

{#snippet contextMenuSlot()}
<ContextMenuSection>
<ContextMenuItem
label="Create pull request"
onclick={() => {
isDraft = false;
createDraft.set(false);
createPrDropDown?.close();
}}
/>
<ContextMenuItem
label="Create draft pull request"
onclick={() => {
isDraft = true;
createDraft.set(true);
createPrDropDown?.close();
}}
/>
Expand Down
42 changes: 0 additions & 42 deletions apps/desktop/src/lib/pr/PullRequestButton.svelte

This file was deleted.

19 changes: 0 additions & 19 deletions apps/desktop/src/lib/pr/pr.ts

This file was deleted.

0 comments on commit 008d44c

Please sign in to comment.