From 5ac3c296fab956ee024c0c94bbf0c9c993553129 Mon Sep 17 00:00:00 2001 From: sokolova-an Date: Thu, 30 Jan 2025 14:51:53 +0100 Subject: [PATCH] fix: select mutishard account transfer --- src/renderer/widgets/Transfer/model/form-model.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/renderer/widgets/Transfer/model/form-model.ts b/src/renderer/widgets/Transfer/model/form-model.ts index 59958e8400..8eb5ba52db 100644 --- a/src/renderer/widgets/Transfer/model/form-model.ts +++ b/src/renderer/widgets/Transfer/model/form-model.ts @@ -18,7 +18,6 @@ import { type Transaction, TransactionType, } from '@/shared/core'; -import { waitFor } from '@/shared/effector'; import { TEST_ACCOUNTS, ZERO_BALANCE, @@ -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 }; },