Skip to content

Commit d29e306

Browse files
Merge pull request #5782 from gitbutlerapp/fix-error-on-startup-and-leaving-edit-mode
Fix error when starting up in edit mode
2 parents cb9258e + ad50ef0 commit d29e306

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

apps/desktop/src/lib/vbranches/virtualBranch.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { plainToInstance } from 'class-transformer';
55
import { writable } from 'svelte/store';
66
import type { BranchListingService } from '$lib/branches/branchListing';
77
import type { ProjectMetrics } from '$lib/metrics/projectMetrics';
8+
import type { ModeService } from '$lib/modes/service';
89

910
export function allPreviousSeriesHavePrNumber(
1011
seriesName: string,
@@ -45,14 +46,16 @@ export class VirtualBranchService {
4546
});
4647

4748
constructor(
48-
private projectId: string,
49-
private projectMetrics: ProjectMetrics,
50-
private branchListingService: BranchListingService
49+
private readonly projectId: string,
50+
private readonly projectMetrics: ProjectMetrics,
51+
private readonly branchListingService: BranchListingService,
52+
private readonly modeService: ModeService
5153
) {}
5254

5355
async refresh() {
5456
this.loading.set(true);
5557
try {
58+
await this.modeService.awaitNotEditing();
5659
this.handlePayload(await this.listVirtualBranches());
5760
this.branchListingService.refresh();
5861
} catch (err: unknown) {

apps/desktop/src/routes/[projectId]/+layout.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@ export const load: LayoutLoad = async ({ params, parent }) => {
6565
const branchListingService = new BranchListingService(projectId);
6666
const gitBranchService = new GitBranchService(projectId);
6767

68-
const vbranchService = new VirtualBranchService(projectId, projectMetrics, branchListingService);
68+
const vbranchService = new VirtualBranchService(
69+
projectId,
70+
projectMetrics,
71+
branchListingService,
72+
modeService
73+
);
6974

7075
const branchController = new BranchController(
7176
projectId,

0 commit comments

Comments
 (0)