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

* fix link account modal button disabled

* note
This commit is contained in:
Matt Fiddaman
2026-04-18 23:25:28 +01:00
committed by GitHub
parent 9682f6d8c9
commit 695fd0e7e0
2 changed files with 16 additions and 1 deletions

View File

@@ -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(

View File

@@ -0,0 +1,6 @@
---
category: Bugfixes
authors: [matt-fidd]
---
Fix bank sync account linking modal being disabled when relinking existing accounts