Skip to content

Commit

Permalink
fix: select mutishard account transfer (#3075)
Browse files Browse the repository at this point in the history
  • Loading branch information
sokolova-an authored Jan 30, 2025
1 parent 6234ce1 commit 8ee699d
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/renderer/widgets/Transfer/model/form-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
type Transaction,
TransactionType,
} from '@/shared/core';
import { waitFor } from '@/shared/effector';
import {
TEST_ACCOUNTS,
ZERO_BALANCE,
Expand Down Expand Up @@ -528,16 +527,12 @@ sample({
target: $transferForm.fields.destination.reset,
});

const accountsUpdated = waitFor({
source: $accounts,
clock: $transferForm.fields.account.$value,
filter: nonNullable,
});

sample({
clock: accountsUpdated,
fn: ({ event: accounts, trigger: account }) => {
const match = accounts.find((a) => a.account.id === account.id);
clock: $transferForm.fields.account.onChange,
source: $accounts,
filter: (_, account) => nonNullable(account),
fn: (accounts, account) => {
const match = accounts.find((a) => a.account.id === account!.id);

return match?.balances || { balance: ZERO_BALANCE, native: ZERO_BALANCE };
},
Expand Down

0 comments on commit 8ee699d

Please sign in to comment.