From 98ac164ac81d8bf47635ab29758e971344e589ae Mon Sep 17 00:00:00 2001 From: centdix Date: Sun, 22 Feb 2026 14:11:44 +0000 Subject: [PATCH] merge --- dev-dashboard/frontend/src/App.svelte | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/dev-dashboard/frontend/src/App.svelte b/dev-dashboard/frontend/src/App.svelte index c00c4f929c..c071abffab 100644 --- a/dev-dashboard/frontend/src/App.svelte +++ b/dev-dashboard/frontend/src/App.svelte @@ -75,18 +75,19 @@ } } + function selectNeighborOf(branch: string) { + if (selectedBranch !== branch) return; + const idx = visibleWorktrees.findIndex((w) => w.branch === branch); + const neighbor = visibleWorktrees[idx - 1] ?? visibleWorktrees[idx + 1]; + const isNeighborMain = neighbor && (neighbor.path === "(here)" || neighbor.branch === "main"); + selectedBranch = neighbor && !isNeighborMain ? neighbor.branch : null; + } + async function handleRemove() { const branch = removeBranch; if (!branch) return; removeBranch = null; - - // Select neighbor before starting the async removal - if (selectedBranch === branch) { - const idx = visibleWorktrees.findIndex((w) => w.branch === branch); - const neighbor = visibleWorktrees[idx - 1] ?? visibleWorktrees[idx + 1]; - const isNeighborMain = neighbor && (neighbor.path === "(here)" || neighbor.branch === "main"); - selectedBranch = neighbor && !isNeighborMain ? neighbor.branch : null; - } + selectNeighborOf(branch); removingBranches = new Set([...removingBranches, branch]); try { @@ -108,14 +109,7 @@ try { await api.mergeWorktree(branch); mergeBranch = null; - - if (selectedBranch === branch) { - const idx = visibleWorktrees.findIndex((w) => w.branch === branch); - const neighbor = visibleWorktrees[idx - 1] ?? visibleWorktrees[idx + 1]; - const isNeighborMain = neighbor && (neighbor.path === "(here)" || neighbor.branch === "main"); - selectedBranch = neighbor && !isNeighborMain ? neighbor.branch : null; - } - + selectNeighborOf(branch); await refresh(); } catch (err) { mergeError = err instanceof Error ? err.message : String(err);