Fixed initializing RecipientFinder (which is quite expensive) only once
This commit is contained in:
parent
89b700b740
commit
77c944d33b
|
@ -68,7 +68,7 @@ fun TransferMoneyDialog(
|
|||
}
|
||||
|
||||
|
||||
val recipientFinder = RecipientFinder(DI.bankFinder)
|
||||
val recipientFinder = remember { RecipientFinder(DI.bankFinder) }
|
||||
|
||||
|
||||
var isTransferringMoney by remember { mutableStateOf(false) }
|
||||
|
@ -77,14 +77,11 @@ fun TransferMoneyDialog(
|
|||
|
||||
val verticalSpace = 8.dp
|
||||
|
||||
var isInitialized by remember { mutableStateOf(false) }
|
||||
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
|
||||
|
||||
coroutineScope.launch {
|
||||
recipientFinder.updateData(bankingService.getAllAccountTransactions()) // only a bit problematic: if in the meantime new transactions are retrieved, then RecipientFinder doesn't contain the newly retrieved transactions
|
||||
}
|
||||
|
||||
|
||||
fun confirmCalled() {
|
||||
isTransferringMoney = true
|
||||
|
||||
|
@ -229,4 +226,15 @@ fun TransferMoneyDialog(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LaunchedEffect(isInitialized) {
|
||||
if (isInitialized == false) {
|
||||
isInitialized = true
|
||||
|
||||
coroutineScope.launch {
|
||||
recipientFinder.updateData(bankingService.getAllAccountTransactions()) // only a bit problematic: if in the meantime new transactions are retrieved, then RecipientFinder doesn't contain the newly retrieved transactions
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue