Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail loudly if workspace state out of sync #5616

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading