Skip to content

A local-first personal finance app

fix bank sync account linking modal being disabled when relinking existing accounts (#7487)

Matt Fiddaman695fd0e7e023
diff --git a/packages/desktop-client/src/components/modals/SelectLinkedAccountsModal.tsx b/packages/desktop-client/src/components/modals/SelectLinkedAccountsModal.tsx
index 421c09c7e7..aff9060f8f 100644
--- a/packages/desktop-client/src/components/modals/SelectLinkedAccountsModal.tsx
+++ b/packages/desktop-client/src/components/modals/SelectLinkedAccountsModal.tsx
@@ -128,7 +128,16 @@ export function SelectLinkedAccountsModal({
const localAccounts = allAccounts.filter(a => a.closed === 0);
const [draftLinkAccounts, setDraftLinkAccounts] = useState<
Map<string, 'linking' | 'unlinking'>
- >(new Map());
+ >(() => {
+ const externalAccountIds = new Set(externalAccounts.map(a => a.account_id));
+ const initial = new Map<string, 'linking' | 'unlinking'>();
+ for (const acc of localAccounts) {
+ if (acc.account_id && externalAccountIds.has(acc.account_id)) {
+ initial.set(acc.account_id, 'linking');
+ }
+ }
+ return initial;
+ });
const [chosenAccounts, setChosenAccounts] = useState<Record<string, string>>(
() => {
return Object.fromEntries(
diff --git a/upcoming-release-notes/7487.md b/upcoming-release-notes/7487.md
new file mode 100644
index 0000000000..212cbcc310
--- /dev/null
+++ b/upcoming-release-notes/7487.md
@@ -0,0 +1,6 @@
+---
+category: Bugfixes
+authors: [matt-fidd]
+---
+
+Fix bank sync account linking modal being disabled when relinking existing accounts