diff --git a/apps/desktop/src/components/SelectionView.svelte b/apps/desktop/src/components/SelectionView.svelte index 056dbbb84d..fffe5a59df 100644 --- a/apps/desktop/src/components/SelectionView.svelte +++ b/apps/desktop/src/components/SelectionView.svelte @@ -6,7 +6,7 @@ import { isExecutableStatus } from '$lib/hunks/change'; import { DIFF_SERVICE } from '$lib/hunks/diffService.svelte'; import { FILE_SELECTION_MANAGER } from '$lib/selection/fileSelectionManager.svelte'; - import { readKey, type SelectionId } from '$lib/selection/key'; + import { type SelectionId } from '$lib/selection/key'; import { inject } from '@gitbutler/core/context'; type Props = { @@ -35,13 +35,11 @@ const diffService = inject(DIFF_SERVICE); const selection = $derived(selectionId ? idSelection.valuesReactive(selectionId) : undefined); - const lastAdded = $derived(selectionId ? idSelection.getById(selectionId).lastAdded : undefined); - const selectedFile = $derived.by(() => { - if (!selectionId || !selection) return; - if (selection.current.length === 0) return; - if (selection.current.length === 1 || !$lastAdded) return selection.current[0]; - return readKey($lastAdded.key); + const selectedFiles = $derived.by(() => { + if (!selectionId || !selection) return []; + if (selection.current.length === 0) return []; + return selection.current; }); const stackId = $derived( @@ -52,49 +50,51 @@