Below is a PR with changes in the export preview screen. After the update, users noticed that the progress indicator and the final status sometimes behave unpredictably when quickly restarting the operation and when leaving the screen while it is running.
ViewModel state.ExportRepository contract.Start export, then immediately press Start export again with a different documentId.progress and the final status.For local verification, it is enough to consider the behavior of PreviewExportViewModel and FakeExportRepository from the diff.
uiState state must not be updated by results from an outdated operation.ViewModel.viewModelScope from androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.3ViewModel, without ComposePreviewExportViewModel instance after the old one is destroyedExportRepository contract: export(documentId: String, onProgress: (Int) -> Unit): String sends intermediate progress through a callback and completes with a string statusUse line comments to explain the problem, its impact, the fix and how to test it.