Skip to content

Commit 48a09e9

Browse files
authored
Merge pull request #7896 from gitbutlerapp/e-branch-2
Discarding a file unselects it
2 parents cac0234 + 6f65940 commit 48a09e9

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
branchId?: string;
2525
trigger?: HTMLElement;
2626
isBinary?: boolean;
27+
unSelectChanges: (changes: TreeChange[]) => void;
2728
};
2829
2930
type FileItem = {
@@ -40,7 +41,7 @@
4041
);
4142
}
4243
43-
const { trigger, isUnapplied, isBinary = false }: Props = $props();
44+
const { trigger, isUnapplied, isBinary = false, unSelectChanges }: Props = $props();
4445
const [stackService, project] = inject(StackService, Project);
4546
const userSettings = getContextStoreBySymbol<Settings, Writable<Settings>>(SETTINGS);
4647
@@ -67,6 +68,8 @@
6768
worktreeChanges
6869
});
6970
71+
unSelectChanges(item.changes);
72+
7073
close();
7174
}
7275

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@
8383
8484
contextMenu?.open(e, { changes: [change] });
8585
}
86+
87+
function unSelectChanges(changes: TreeChange[]) {
88+
for (const change of changes) {
89+
idSelection.remove(change.path, selectedFile);
90+
changeSelection.remove(change.path);
91+
}
92+
}
8693
</script>
8794

8895
<div
@@ -104,6 +111,7 @@
104111
isUnapplied={false}
105112
branchId={$stack?.id}
106113
isBinary={false}
114+
{unSelectChanges}
107115
/>
108116
{#if isHeader}
109117
<FileViewHeader

0 commit comments

Comments
 (0)