Skip to content

A local-first personal finance app

Fixed a bug where it was possible to make a transfer to the same account as the one making the transfer. (#1038)

Jackec5e98b934e1
diff --git a/packages/desktop-client/src/components/accounts/TransactionsTable.js b/packages/desktop-client/src/components/accounts/TransactionsTable.js
index 3bf1914432..2ececa01b8 100644
--- a/packages/desktop-client/src/components/accounts/TransactionsTable.js
+++ b/packages/desktop-client/src/components/accounts/TransactionsTable.js
@@ -403,6 +403,7 @@ function PayeeCell({
// Filter out the account we're currently in as it is not a valid transfer
accounts = accounts.filter(account => account.id !== accountId);
+ payees = payees.filter(payee => payee.transfer_acct !== accountId);
return (
<CustomCell
diff --git a/packages/desktop-client/src/components/autocomplete/PayeeAutocomplete.js b/packages/desktop-client/src/components/autocomplete/PayeeAutocomplete.js
index d826bc1fb3..86904ff985 100644
--- a/packages/desktop-client/src/components/autocomplete/PayeeAutocomplete.js
+++ b/packages/desktop-client/src/components/autocomplete/PayeeAutocomplete.js
@@ -181,10 +181,19 @@ export default function PayeeAutocomplete({
onUpdate,
onSelect,
onManagePayees,
+ accounts,
+ payees,
...props
}) {
- let payees = useCachedPayees();
- let accounts = useCachedAccounts();
+ let cachedPayees = useCachedPayees();
+ if (!payees) {
+ payees = cachedPayees;
+ }
+
+ let cachedAccounts = useCachedAccounts();
+ if (!accounts) {
+ accounts = cachedAccounts;
+ }
let [focusTransferPayees, setFocusTransferPayees] = useState(
defaultFocusTransferPayees,
diff --git a/upcoming-release-notes/1038.md b/upcoming-release-notes/1038.md
new file mode 100644
index 0000000000..8018b0b88d
--- /dev/null
+++ b/upcoming-release-notes/1038.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [Miodec]
+---
+
+Fixed a bug where it was possible to make a transfer to the same account as the one making the transfer.