in conv list: show loading spinner as long as request is running#6206
Merged
Conversation
Problem The shimmer loading skeleton (and the pull-to-refresh spinner) were dismissed after the first emission from the local Room database — even if that emission was an empty list. The network fetch still running in the background was invisible to the user, causing an empty-state flash followed by the actual data appearing. Changes ConversationsListViewModel.kt Removed _isShimmerVisible: MutableStateFlow(true) (which was toggled off prematurely on any DB emission). Added _isLoadingRooms: MutableStateFlow(true) — set to true when getRooms() starts, false only after the repository Job fully completes (both local DB and network sync are done). isShimmerVisible is now a combine of _isLoadingRooms and getRoomsStateFlow: shimmer is visible while loading is in progress AND the room list is still empty. This means: Initial load with no cached data → shimmer stays until the network fetch finishes. Subsequent pull-to-refresh with existing data → shimmer doesn't re-appear (list isn't empty), but the swipe indicator handles that. Moved getRoomsStateFlow declaration before isShimmerVisible to fix initialization order. ConversationsListActivity.kt Removed isRefreshingState.value = false from the GetRoomsSuccessState branch (which fired too early, after the first DB emission). Added a isLoadingRooms collector: isRefreshingState is set to false only when isLoadingRooms becomes false, i.e. after the full load cycle completes. AI-assistant: Github Copilot 1.8.2-243 (Claude Sonnet 4.6) Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
751e512 to
7e15e37
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.
🏁 Checklist
/backport to stable-xx.x