From 710f515c4dfb8b5f34573f6a8f4aa82d0509bb7c Mon Sep 17 00:00:00 2001 From: Mattias Granlund Date: Thu, 24 Jul 2025 22:40:39 +0200 Subject: [PATCH] Clear exclusive action if branch not found This clear up some cases where "start commit" is incorrectly disabled. --- apps/desktop/src/components/StackView.svelte | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/apps/desktop/src/components/StackView.svelte b/apps/desktop/src/components/StackView.svelte index cdfd3be692..0698cab85f 100644 --- a/apps/desktop/src/components/StackView.svelte +++ b/apps/desktop/src/components/StackView.svelte @@ -224,6 +224,27 @@ } }); + // Clear exclusive action if branch cannot be found. + // TODO: We must be able to express this better.. + $effect(() => { + if (projectState.exclusiveAction.current && branchesResult.current.data) { + ensureValidExclusiveAction(); + } + }); + + function ensureValidExclusiveAction() { + const exclusiveAction = projectState.exclusiveAction.current; + const branches = branchesResult.current.data; + if (exclusiveAction && branches) { + if ('branchName' in exclusiveAction) { + const branchName = exclusiveAction.branchName; + if (branchName && !branches.some((b) => b.name === branchName)) { + projectState.exclusiveAction.set(undefined); + } + } + } + } + const startCommitVisible = $derived(uncommittedService.startCommitVisible(stack.id)); function onerror(err: unknown) {