fix(directory-explorer): clear selections on Finder pick; dedup VS Code batch

Two findings from the openchamber-bot review at 478f1e9c:

1. Pending selections silently swallowed the Open-in-Finder pick
   (prev #4). handleOpenInFinder flows into the batch-first branch of
   finalizeSelection, so with checkboxes ticked the OS pick was
   ignored and the selections were added instead. Clear selectedPaths
   before finalizeSelection so the Finder-sourced target is honored.

2. Within-batch dedup was missing in the VS Code branch (nit from
   the previous review). A path repeated within one batch hit
   addWorkspaceFolder twice. Mirror the non-VS Code contract with
   a seen Set; add a regression test asserting the host is called
   once per unique path.
This commit is contained in:
herjarsa
2026-08-28 19:15:39 +02:00
parent 478f1e9c03
commit 23219d4049
3 changed files with 24 additions and 1 deletions
@@ -555,6 +555,9 @@ export const DirectoryExplorerDialog: React.FC<DirectoryExplorerDialogProps> = (
return;
}
// Clear pending selections so the Finder-sourced target is honored
// instead of silently being absorbed by the batch branch.
setSelectedPaths([]);
await finalizeSelection(result.path);
} catch (error) {
toast.error(t('directoryExplorerDialog.toast.failedToSelectDirectory'), {