diff --git a/packages/desktop-client/src/components/accounts/TransactionsTable.js b/packages/desktop-client/src/components/accounts/TransactionsTable.js index 37f520618273ad8cce8ddb8d3e07aa0e43c895dc..81b92b7f086aefb9e4b0a64ab4b4b84c98c7c729 100644 --- a/packages/desktop-client/src/components/accounts/TransactionsTable.js +++ b/packages/desktop-client/src/components/accounts/TransactionsTable.js @@ -379,6 +379,7 @@ function StatusCell({ function PayeeCell({ id, payeeId, + accountId, focused, inherited, payees, @@ -396,6 +397,9 @@ function PayeeCell({ const isNewAutocompleteEnabled = useFeatureFlag('newAutocomplete'); let isCreatingPayee = useRef(false); + // Filter out the account we're currently in as it is not a valid transfer + accounts = accounts.filter(account => account.id !== accountId); + return ( <CustomCell width="flex" @@ -786,6 +790,7 @@ export const Transaction = React.memo(function Transaction(props) { <PayeeCell id={id} payeeId={payeeId} + accountId={accountId} focused={focusedField === 'payee'} inherited={inheritedFields && inheritedFields.has('payee')} payees={payees} diff --git a/packages/desktop-client/src/components/autocomplete/NewPayeeAutocomplete.js b/packages/desktop-client/src/components/autocomplete/NewPayeeAutocomplete.js index 888217e6cfa3955e494e6811510a6d5480606f0a..6c4f31c8cafbbf7c6b65c2c213685136f1ed8095 100644 --- a/packages/desktop-client/src/components/autocomplete/NewPayeeAutocomplete.js +++ b/packages/desktop-client/src/components/autocomplete/NewPayeeAutocomplete.js @@ -3,8 +3,6 @@ import { useDispatch } from 'react-redux'; import { components as SelectComponents } from 'react-select'; import { createPayee } from 'loot-core/src/client/actions/queries'; -import { useCachedAccounts } from 'loot-core/src/client/data-hooks/accounts'; -import { useCachedPayees } from 'loot-core/src/client/data-hooks/payees'; import { getActivePayees } from 'loot-core/src/client/reducers/queries'; import Add from '../../icons/v1/Add'; @@ -51,6 +49,8 @@ function MenuListWithFooter(props) { } export default function PayeeAutocomplete({ + payees, + accounts, value, multi = false, showMakeTransfer = true, @@ -60,9 +60,6 @@ export default function PayeeAutocomplete({ onManagePayees, ...props }) { - const payees = useCachedPayees(); - const accounts = useCachedAccounts(); - const [focusTransferPayees, setFocusTransferPayees] = useState( defaultFocusTransferPayees, ); diff --git a/upcoming-release-notes/902.md b/upcoming-release-notes/902.md new file mode 100644 index 0000000000000000000000000000000000000000..ff004d0a4712b5d6bf740a7c78de811ca819f99e --- /dev/null +++ b/upcoming-release-notes/902.md @@ -0,0 +1,6 @@ +--- +category: Bugfix +authors: [biohzrddd] +--- + +Remove currently viewed account from list of possible transfer accounts