Skip to content

in conv list: show loading spinner as long as request is running#6206

Merged
mahibi merged 1 commit into
masterfrom
showLoadingSpinnerWhileLoadingConvList
May 15, 2026
Merged

in conv list: show loading spinner as long as request is running#6206
mahibi merged 1 commit into
masterfrom
showLoadingSpinnerWhileLoadingConvList

Conversation

@mahibi
Copy link
Copy Markdown
Collaborator

@mahibi mahibi commented May 15, 2026

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔖 Capability is checked or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

@mahibi mahibi added this to the 24.0.0 milestone May 15, 2026
@mahibi mahibi self-assigned this May 15, 2026
@mahibi mahibi added the 3. to review Waiting for reviews label May 15, 2026
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>
@mahibi mahibi force-pushed the showLoadingSpinnerWhileLoadingConvList branch from 751e512 to 7e15e37 Compare May 15, 2026 12:54
@mahibi mahibi merged commit 85af584 into master May 15, 2026
9 of 17 checks passed
@mahibi mahibi deleted the showLoadingSpinnerWhileLoadingConvList branch May 15, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant