fix: replace snackbar-based batch progress with state-driven composable#1509
Merged
Conversation
65529ef to
8cb194a
Compare
Fixes #1504 The batch disable/enable progress display was lagging behind the actual operation because SnackbarHostState.showSnackbar() enforces a minimum 3-second display duration per call. Each component processed queued a new snackbar, causing the UI to show stale progress long after completion. Replace the snackbar-based approach with a state-driven ProcessingProgressSnackbar composable that updates instantly via ViewModel StateFlow. Applied to both AppDetail and RuleDetail screens.
8cb194a to
4a50c96
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1504
SnackbarHostState.showSnackbar()progress display with a state-drivenProcessingProgressSnackbarcomposable that updates instantlyProcessingProgressdata class andProcessingProgressSnackbarcomposable tocore:uiRoot Cause
showSnackbar()is a suspend function that enforces a minimum ~3-second display (SnackbarDuration.Short). During batch operations processing 100+ components, each emission queued a new snackbar — the UI showed "5/100" long after all 100 components were already done.Solution
Progress is now a piece of
StateFlowstate in the ViewModel. The composable reads it reactively and re-renders instantly on every update, bypassing the snackbar queue entirely. Progress auto-clears 2 seconds after completion.Test plan
./gradlew :feature:appdetail:impl:testFossDebugUnitTestpasses./gradlew :feature:ruledetail:impl:testFossDebugUnitTestpasses./gradlew spotlessCheckpasses