whisper-money/resources/js/components/transactions
Víctor Falcón 9a20335c6a
fix(transactions): only auto-select account on account pages (#549)
## What

When the add/edit transaction dialog resets in **create** mode, it no
longer auto-selects the first transactional account. The account field
starts empty so the user must pick one deliberately.

The only exception is the account detail page (`accounts/{uuid}`), which
passes `initialAccountId`; there the dialog still pre-selects that
account.

## Why

Auto-selecting the first account made it easy to accidentally book a
transaction to the wrong account. Forcing a deliberate pick (except
where the account is unambiguous from context) avoids that.

## How

- `edit-transaction-dialog.tsx`: dropped the `availableAccounts[0]`
fallback. The field now resolves to `initialAccount?.id ?? ''`.
- The existing submit guard (`Account is required`) already covers the
empty case.
- `Accounts/Show.tsx` already passes `initialAccountId={account.id}`, so
the account-page behavior is unchanged; the transactions list passes
nothing, so it now starts empty.

## Tests

Added two unit tests to `edit-transaction-dialog.test.tsx`:
- no `initialAccountId` → account value stays empty (no auto-select)
- matching `initialAccountId` → account is pre-selected
2026-06-17 11:28:31 +00:00
..
bulk-actions-bar.tsx Fix label creation dropdown refresh (#363) 2026-05-07 10:26:43 +01:00
bulk-category-select.tsx feat: Spanish localization (#74) 2026-02-08 11:58:08 +01:00
bulk-label-select.tsx Fix label creation dropdown refresh (#363) 2026-05-07 10:26:43 +01:00
categorizer-card.tsx feat(categorize): show debtor and creditor names (#454) 2026-05-30 12:27:59 +02:00
categorizer-command.tsx feat: parent/child category tree (#474) 2026-06-03 19:30:12 +02:00
category-cell.tsx feat(ai): share AI sparkle icon and mark AI-generated rules (#538) 2026-06-15 18:22:11 +02:00
category-select.tsx feat(shared): Add CategoryCombobox component 2025-11-14 16:05:53 +01:00
edit-transaction-dialog.test.tsx fix(transactions): only auto-select account on account pages (#549) 2026-06-17 11:28:31 +00:00
edit-transaction-dialog.tsx fix(transactions): only auto-select account on account pages (#549) 2026-06-17 11:28:31 +00:00
encrypted-transaction-description.tsx feat: Plaintext transactions behind feature flag (#105) 2026-02-10 14:31:24 +01:00
import-step-account.test.tsx Fix transaction importer account preselect (#396) 2026-05-14 12:38:44 +02:00
import-step-account.tsx Fix transaction importer account preselect (#396) 2026-05-14 12:38:44 +02:00
import-step-mapping.tsx fix(import): honor selected date format for CSV imports (#494) 2026-06-05 15:10:48 +02:00
import-step-preview.tsx feat(import): calculate balances from transactions (#403) 2026-05-20 10:29:14 +01:00
import-step-upload.test.tsx Fix transaction importer account preselect (#396) 2026-05-14 12:38:44 +02:00
import-step-upload.tsx Fix transaction importer account preselect (#396) 2026-05-14 12:38:44 +02:00
import-transactions-button.tsx fix(i18n): translate Unknown Income/Expense and other missing ES strings (#331) 2026-04-24 17:58:26 +01:00
import-transactions-drawer.tsx fix(import): honor selected date format for CSV imports (#494) 2026-06-05 15:10:48 +02:00
saved-filters.tsx feat(transactions): save and reuse transaction filters (#496) 2026-06-05 18:00:14 +02:00
transaction-actions-menu.test.tsx feat(transactions): filtered analysis dashboard (#507) 2026-06-08 14:04:00 +02:00
transaction-actions-menu.tsx fix(transactions): improve mobile analysis button affordance (#520) 2026-06-12 16:21:23 +02:00
transaction-analysis-drawer.test.tsx feat(analysis): shared bar-list breakdowns in transaction drawer (#517) 2026-06-10 12:36:20 +02:00
transaction-analysis-drawer.tsx feat(analysis): shared bar-list breakdowns in transaction drawer (#517) 2026-06-10 12:36:20 +02:00
transaction-columns.tsx feat(ai): auto-categorize transactions with AI (behind flag) (#535) 2026-06-15 16:35:20 +02:00
transaction-filters.tsx feat(ai): share AI sparkle icon and mark AI-generated rules (#538) 2026-06-15 18:22:11 +02:00
transaction-list.tsx feat: optionally update manual account balance on transaction delete (#491) 2026-06-05 11:30:31 +02:00