From 4d1669523a5ff3c0ddc20deccd0c2961e2da5e6f Mon Sep 17 00:00:00 2001 From: Gibran Chevalley Date: Fri, 18 Oct 2024 11:01:28 +0200 Subject: [PATCH] Remove unnecessary derivedStateOf --- .../screen/newtransfer/importfiles/ImportFilesScreen.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt index 4aa73a150..c3e63a170 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt @@ -76,9 +76,12 @@ private fun ImportFilesScreen( val spaceLeft = (TOTAL_FILE_SIZE - usedSpace).coerceAtLeast(0) getHumanReadableSize(context, spaceLeft) } - val isSendButtonEnabled by remember { derivedStateOf { importedFiles.isNotEmpty() } } - val isImporting by remember { derivedStateOf { filesToImportCount() > 0 } } - val importProgress by remember { derivedStateOf { 1 - (filesToImportCount().toFloat() / currentSessionTotalUploadedFiles()) } } + + val count = filesToImportCount() + val isImporting by remember(count) { derivedStateOf { count > 0 } } + + val total = currentSessionTotalUploadedFiles() + val importProgress = remember(count, total) { 1 - (count.toFloat() / total) } val filePickerLauncher = rememberLauncherForActivityResult( contract = ActivityResultContracts.OpenMultipleDocuments()