Skip to content

Commit ef61bd7

Browse files
committed
feat(web): suggest all branches in Bought-a-box + Return-to-bank pickers (om-35r3)
The Do-tab bank datalists were built only from names already on a transaction, so a branch with no txns yet wouldn't suggest. Fold in the full branch list (ADR-010) at these two entry points — where typo forks originate — so entry reuses an existing branch instead of minting a new one.
1 parent 9a95743 commit ef61bd7

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

web/app/src/lib/components/workflows/BoughtABox.svelte

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,14 @@
5050
5151
onMount(async () => {
5252
try {
53-
const [rolls, trips] = await Promise.all([api.rollTxns.list(), api.trips.list()])
54-
banks = distinct([...rolls.map((r: RollTxn) => r.bank), ...trips.map((t: Trip) => t.bank)])
53+
const [rolls, trips, branches] = await Promise.all([api.rollTxns.list(), api.trips.list(), api.branches.list()])
54+
// Suggest every known branch (ADR-010) — not just names already on a txn —
55+
// so entry reuses an existing branch instead of forking a new one on a typo.
56+
banks = distinct([
57+
...branches.map((b) => b.name),
58+
...rolls.map((r: RollTxn) => r.bank),
59+
...trips.map((t: Trip) => t.bank),
60+
])
5561
} catch {
5662
/* suggestions optional */
5763
}

web/app/src/lib/components/workflows/ReturnToBank.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@
4141
onMount(async () => {
4242
amount = outstanding // pre-fill with everything still owed back
4343
try {
44-
const [rolls, trips] = await Promise.all([api.rollTxns.list(), api.trips.list()])
44+
const [rolls, trips, branches] = await Promise.all([api.rollTxns.list(), api.trips.list(), api.branches.list()])
4545
banks = distinct([
46+
...branches.map((b) => b.name), // every known branch (ADR-010), reuse over fork
4647
...rolls.map((r: RollTxn) => r.bank),
4748
...trips.map((t: Trip) => t.bank),
4849
])

0 commit comments

Comments
 (0)