Skip to content

Commit

Permalink
Fail loudly if workspace state out of sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Caleb-T-Owens committed Nov 19, 2024
1 parent 62ea095 commit d12c1cb
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions apps/desktop/src/lib/vbranches/upstreamIntegrationService.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { invoke } from '$lib/backend/ipc';
import { VirtualBranchService } from '$lib/vbranches/virtualBranch';
import { isDefined } from '@gitbutler/ui/utils/typeguards';
import { derived, readable, type Readable } from 'svelte/store';
import type { Project } from '$lib/backend/projects';
import type { VirtualBranch } from '$lib/vbranches/types';
Expand Down Expand Up @@ -135,18 +134,20 @@ export class UpstreamIntegrationService {

return {
type: 'updatesRequired',
subject: branchStatuses.subject
.map((status) => {
const stack = branches.find((appliedBranch) => appliedBranch.id === status[0]);

if (!stack) return;

return {
stack,
status: status[1]
};
})
.filter(isDefined)
subject: branchStatuses.subject.map((status) => {
const stack = branches.find((appliedBranch) => appliedBranch.id === status[0]);

if (!stack) {
throw new Error(
`Could not find stack with id ${status[0]}. Please report this issue and try restarting the app and trying again.`
);
}

return {
stack,
status: status[1]
};
})
};
}
);
Expand Down

0 comments on commit d12c1cb

Please sign in to comment.