Skip to content

Commit

Permalink
Remove unnecessary derivedStateOf
Browse files Browse the repository at this point in the history
  • Loading branch information
LunarX committed Oct 18, 2024
1 parent 7cdfb2c commit 4d16695
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 4d16695

Please sign in to comment.