Skip to content

Commit

Permalink
🐛 (bank-sync) fix initial sync - close modal stack, show loading indi…
Browse files Browse the repository at this point in the history
…cators (#3540)
  • Loading branch information
MatissJanis authored Oct 2, 2024
1 parent 5064b06 commit 47ef916
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useState } from 'react';
import { useDispatch } from 'react-redux';

import {
closeModal,
linkAccount,
linkAccountSimpleFin,
unlinkAccount,
Expand Down Expand Up @@ -90,6 +91,8 @@ export function SelectLinkedAccountsModal({
}
},
);

dispatch(closeModal());
}

const unlinkedAccounts = localAccounts.filter(
Expand Down Expand Up @@ -176,10 +179,7 @@ export function SelectLinkedAccountsModal({
>
<Button
variant="primary"
onPress={() => {
onNext();
close();
}}
onPress={onNext}
isDisabled={!Object.keys(chosenAccounts).length}
>
Link accounts
Expand Down
21 changes: 19 additions & 2 deletions packages/loot-core/src/client/actions/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,17 @@ export function unlinkAccount(id: string) {
};
}

export function linkAccount(requisitionId, account, upgradingId, offBudget) {
export function linkAccount(
requisitionId: string,
account: unknown,
upgradingId?: string,
offBudget?: boolean,
) {
return async (dispatch: Dispatch) => {
if (upgradingId) {
await dispatch(setAccountsSyncing([upgradingId]));
}

await send('gocardless-accounts-link', {
requisitionId,
account,
Expand All @@ -68,8 +77,16 @@ export function linkAccount(requisitionId, account, upgradingId, offBudget) {
};
}

export function linkAccountSimpleFin(externalAccount, upgradingId, offBudget) {
export function linkAccountSimpleFin(
externalAccount: unknown,
upgradingId?: string,
offBudget?: boolean,
) {
return async (dispatch: Dispatch) => {
if (upgradingId) {
await dispatch(setAccountsSyncing([upgradingId]));
}

await send('simplefin-accounts-link', {
externalAccount,
upgradingId,
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/3540.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [MatissJanis]
---

BankSync: fix showing sync status after linking and close all modal stack.

0 comments on commit 47ef916

Please sign in to comment.