Skip to content

Commit 2f43198

Browse files
committed
Clear exclusive action if branch not found
This clear up some cases where "start commit" is incorrectly disabled.
1 parent d856e84 commit 2f43198

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

apps/desktop/src/components/StackView.svelte

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,28 @@
224224
}
225225
});
226226
227+
// Clear exclusive action if branch cannot be found.
228+
// TODO: We must be able to express this better..
229+
$effect(() => {
230+
if (projectState.exclusiveAction.current && branchesResult.current.data) {
231+
ensureValidExclusiveAction();
232+
}
233+
});
234+
235+
function ensureValidExclusiveAction() {
236+
const exclusiveAction = projectState.exclusiveAction;
237+
const branches = branchesResult.current.data;
238+
if (exclusiveAction.current && branches) {
239+
if ('branchName' in exclusiveAction) {
240+
const branchName = exclusiveAction.branchName;
241+
if (branchName && !branches.some((b) => b.name === branchName)) {
242+
exclusiveAction.set(undefined);
243+
console.warn('Exclusive action cleared');
244+
}
245+
}
246+
}
247+
}
248+
227249
const startCommitVisible = $derived(uncommittedService.startCommitVisible(stack.id));
228250
229251
function onerror(err: unknown) {

0 commit comments

Comments
 (0)