Skip to content

Commit

Permalink
fix: wire up prService template fns correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ndom91 committed Sep 10, 2024
1 parent 8194283 commit 09b02fe
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/desktop/src/lib/branch/BranchHeader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
const prTemplatePath = project.git_host.pullRequestTemplatePath;
if (prTemplatePath) {
pullRequestTemplateBody = await $gitHost.getPrTemplateContent(prTemplatePath);
pullRequestTemplateBody = await $prService?.getPrTemplateContent(prTemplatePath);
}
if (pullRequestTemplateBody) {
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/lib/gitHost/github/githubPrService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class GitHubPrService implements GitHostPrService {

const availableTemplates: string[] | undefined = await invoke(
'available_pull_request_templates',
{ path: targetPath }
{ rootPath: targetPath }
);

return availableTemplates;
Expand Down
5 changes: 4 additions & 1 deletion apps/desktop/src/lib/settings/GitHostForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { Project, ProjectService } from '$lib/backend/projects';
import SectionCard from '$lib/components/SectionCard.svelte';
import { getGitHost } from '$lib/gitHost/interface/gitHost';
import { createGitHostPrServiceStore } from '$lib/gitHost/interface/gitHostPrService';
import Select from '$lib/select/Select.svelte';
import SelectItem from '$lib/select/SelectItem.svelte';
import Section from '$lib/settings/Section.svelte';
Expand All @@ -12,14 +13,16 @@
const projectService = getContext(ProjectService);
const project = getContext(Project);
const gitHost = getGitHost();
const prService = createGitHostPrServiceStore(undefined);
$effect(() => prService.set($gitHost?.prService()));
let useTemplate = $state(!!project.git_host?.pullRequestTemplatePath);
let selectedTemplate = $state(project.git_host?.pullRequestTemplatePath ?? '');
let allAvailableTemplates = $state<{ label: string; value: string }[]>([]);
$effect(() => {
if (!project.path) return;
$gitHost?.getAvailablePrTemplates(project.path).then((availableTemplates) => {
$prService?.getAvailablePrTemplates(project.path).then((availableTemplates) => {
if (availableTemplates) {
allAvailableTemplates = availableTemplates.map((availableTemplate) => {
return {
Expand Down

0 comments on commit 09b02fe

Please sign in to comment.