File tree Expand file tree Collapse file tree 1 file changed +18
-17
lines changed
frontends/web/src/routes/bitsurance Expand file tree Collapse file tree 1 file changed +18
-17
lines changed Original file line number Diff line number Diff line change @@ -87,32 +87,33 @@ export const BitsuranceDashboard = ({ accounts }: TProps) => {
8787 accountsInsurance [ insurance . code ] = insurance ;
8888 } ) ;
8989 setInsurances ( accountsInsurance ) ;
90-
91-
9290 } , [ ] ) ;
9391
9492 useEffect ( ( ) => {
9593 setAccountsByKeystore ( getAccountsByKeystore ( accounts ) ) ;
9694 fetchInsurances ( ) ;
97- return ( ) => setInsurances ( undefined ) ;
9895 } , [ fetchInsurances , accounts ] ) ;
9996
10097 useEffect ( ( ) => {
101- if ( ! insurances ) {
102- return ;
103- }
104- Object . keys ( insurances ) . forEach ( accountCode => {
105- getBalance ( accountCode ) . then ( balance => {
106- if ( ! mounted . current ) {
107- return ;
108- }
109- setBalances ( ( prevBalances ) => ( {
110- ...prevBalances ,
111- [ accountCode ] : balance
112- } ) ) ;
113- } ) ;
98+ accountsByKeystore ?. forEach ( keystore => {
99+ keystore . accounts
100+ . filter ( account => ! ! account . bitsuranceStatus )
101+ . forEach ( account => {
102+ getBalance ( account . code ) . then ( balance => {
103+ if ( ! mounted . current ) {
104+ return ;
105+ }
106+ setBalances ( ( prevBalances ) => ( {
107+ ...prevBalances ,
108+ [ account . code ] : balance
109+ } ) ) ;
110+ } ) ;
111+ } ) ;
114112 } ) ;
115- } , [ insurances , mounted , accounts ] ) ;
113+ return ( ) => {
114+ setBalances ( undefined ) ;
115+ } ;
116+ } , [ accountsByKeystore , mounted ] ) ;
116117
117118 return (
118119 < GuideWrapper >
You can’t perform that action at this time.
0 commit comments