A local-first personal finance app
🐛 Fixed GoCardless SelectLinkedAccounts institution bug (#4667)
Alec Bakholdin6b2d2420a5a1
diff --git a/packages/desktop-client/src/components/modals/SelectLinkedAccountsModal.jsx b/packages/desktop-client/src/components/modals/SelectLinkedAccountsModal.jsxindex b5730e0cc3..e29a4104e3 100644--- a/packages/desktop-client/src/components/modals/SelectLinkedAccountsModal.jsx+++ b/packages/desktop-client/src/components/modals/SelectLinkedAccountsModal.jsx@@ -43,10 +43,10 @@ export function SelectLinkedAccountsModal({syncSource = undefined,}) {const sortedExternalAccounts = useMemo(() => {- const toSort = [...externalAccounts];+ const toSort = externalAccounts ? [...externalAccounts] : [];toSort.sort((a, b) =>- a.institution?.localeCompare(b.institution) ||+ getInstitutionName(a)?.localeCompare(getInstitutionName(b)) ||a.name.localeCompare(b.name),);return toSort;@@ -234,6 +234,15 @@ export function SelectLinkedAccountsModal({);}+function getInstitutionName(externalAccount) {+ if (typeof externalAccount?.institution === 'string') {+ return externalAccount?.institution ?? '';+ } else if (typeof externalAccount.institution?.name === 'string') {+ return externalAccount?.institution?.name ?? '';+ }+ return '';+}+function TableRow({externalAccount,chosenAccount,@@ -254,7 +263,7 @@ function TableRow({return (<Row style={{ backgroundColor: theme.tableBackground }}><Field width={175}>- <Tooltip content={externalAccount.institution}>+ <Tooltip content={getInstitutionName(externalAccount)}><Viewstyle={{textOverflow: 'ellipsis',@@ -262,7 +271,7 @@ function TableRow({display: 'block',}}>- {externalAccount.institution}+ {getInstitutionName(externalAccount)}</View></Tooltip></Field>diff --git a/upcoming-release-notes/4667.md b/upcoming-release-notes/4667.mdnew file mode 100644index 0000000000..d925ace954--- /dev/null+++ b/upcoming-release-notes/4667.md@@ -0,0 +1,6 @@+---+category: Bugfix+authors: [alecbakholdin]+---++Fixed bug where GoCardless doesn't work for SelectLinkedAccounts due to different institution structure