branch selector on git stack, with per-stack branch override

This commit is contained in:
Jarek Krochmalski committed 2026-08-23 10:21:00 +02:00
1 parent 534ecf4564
commit 4ba349113d
2 files changed
+8 -3

No files matched your search

+6 -3
View File
@@ -69,6 +69,9 @@
let open = $state(false);
let searchQuery = $state('');
// Update the local value for an instant trigger refresh, then notify the parent (which
// owns the value via onchange). `displayValue` below MUST be $derived or the trigger
// stays frozen on the initial value.
function selectBranch(branch: string) {
value = branch;
open = false;
@@ -77,7 +80,6 @@
}
function clearBranch() {
value = '';
open = false;
searchQuery = '';
onclear?.();
@@ -100,8 +102,9 @@
);
// Display: show the current value; fall back to the placeholder when empty
// (e.g. no branch chosen -> "main").
const displayValue = value || placeholder;
// (e.g. no branch chosen -> "main"). MUST be $derived - a plain const is computed
// once and would freeze the trigger on the initial value.
const displayValue = $derived(value || placeholder);
</script>
<Popover.Root bind:open>
+2
View File
@@ -943,6 +943,8 @@
branches={branches}
loading={branchesLoading}
placeholder="main"
onchange={(v) => { formNewRepoBranch = v; }}
onclear={() => { formNewRepoBranch = 'main'; }}
/>
<p class="text-xs text-muted-foreground">Type a name or pick from the list.</p>
</div>