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 open = $state(false);
let searchQuery = $state(''); 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) { function selectBranch(branch: string) {
value = branch; value = branch;
open = false; open = false;
@@ -77,7 +80,6 @@
} }
function clearBranch() { function clearBranch() {
value = '';
open = false; open = false;
searchQuery = ''; searchQuery = '';
onclear?.(); onclear?.();
@@ -100,8 +102,9 @@
); );
// Display: show the current value; fall back to the placeholder when empty // Display: show the current value; fall back to the placeholder when empty
// (e.g. no branch chosen -> "main"). // (e.g. no branch chosen -> "main"). MUST be $derived - a plain const is computed
const displayValue = value || placeholder; // once and would freeze the trigger on the initial value.
const displayValue = $derived(value || placeholder);
</script> </script>
<Popover.Root bind:open> <Popover.Root bind:open>
+2
View File
@@ -943,6 +943,8 @@
branches={branches} branches={branches}
loading={branchesLoading} loading={branchesLoading}
placeholder="main" 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> <p class="text-xs text-muted-foreground">Type a name or pick from the list.</p>
</div> </div>