Skip to content

Commit 6c4225f

Browse files
committed
fix(branchlist): improve commit selection logic during committing
Refactor commit selection condition to better handle cases when no commit is selected or when the current commit matches the selected one.
1 parent 9684391 commit 6c4225f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

apps/desktop/src/components/v3/BranchList.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,12 @@
254254
{@const selected =
255255
commit.id === selectedCommitId && branchName === selectedBranchName}
256256
{#if isCommitting}
257+
{@const selectedForCommit =
258+
(selectedCommitId === undefined || commit.id === selectedCommitId) &&
259+
branchName === selectedBranchName}
257260
<!-- Only commits to the base can be `last`, see next `CommitGoesHere`. -->
258261
<CommitGoesHere
259-
{selected}
262+
selected={selectedForCommit}
260263
{first}
261264
last={false}
262265
onclick={() => uiState.stack(stackId).selection.set({ branchName, commitId })}

0 commit comments

Comments
 (0)