-
-
Notifications
You must be signed in to change notification settings - Fork 9
fix(02.3): ensure loading states show on every tab switch #379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Phase 02.3: Loading States for Tabs - 1 plan in 1 wave - Adds ChatsState and ContactsState with isLoading flag - Updates ChatsScreen and ContactsScreen to show loading before empty - Follows MapViewModel boolean flag pattern Ready for execution Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add ChatsState data class with isLoading flag - Replace conversations StateFlow with chatsState StateFlow - Add LoadingConversationsState composable with spinner and text - Update ChatsScreen to check isLoading before showing empty state Prevents "No conversations yet" flash while data loads from database.
- Add ContactsState data class with isLoading flag - Replace groupedContacts StateFlow with contactsState StateFlow - Add LoadingContactsState composable with spinner and text - Update ContactsScreen to check isLoading before showing empty state Prevents "No contacts yet" flash while data loads from database.
Tasks completed: 2/2 - Task 1: Add loading states to ChatsViewModel and ChatsScreen - Task 2: Add loading states to ContactsViewModel and ContactsScreen SUMMARY: .planning/phases/02.3-loading-states-for-tabs/02.3-01-SUMMARY.md
- Phase 2.3 verified: 5/5 must-haves pass - UX-LOADING-01 requirement complete - Issue #341 resolved Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…kground Previously, Skip blocked for 8-12 seconds while applyInterfaceChanges() restarted the Reticulum service. Now navigation happens immediately and service restart runs in background. User sees "Loading conversations..." (from phase 2.3) while service initializes. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Greptile OverviewGreptile SummaryThis PR fixes the issue where loading spinners weren't appearing when switching between tabs. The root cause was StateFlow caching - Key changes:
Trade-off note: Setting Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Screen as ChatsScreen/ContactsScreen
participant ViewModel as ChatsViewModel/ContactsViewModel
participant StateFlow
participant Repository
Note over User,Repository: Tab Switch / Screen Entry
User->>Screen: Switch to tab
Screen->>StateFlow: collectAsState()
Note over StateFlow: New collector subscribes
StateFlow->>StateFlow: onStart {} triggered
StateFlow->>Screen: emit(State(isLoading=true))
Screen->>Screen: Show loading spinner
StateFlow->>Repository: Query data (via flatMapLatest)
Repository-->>StateFlow: Flow<List<Data>>
StateFlow->>StateFlow: map to State(data, isLoading=false)
StateFlow->>Screen: emit(State(data, isLoading=false))
Screen->>Screen: Show data list
Note over User,Repository: User navigates away
User->>Screen: Switch to different tab
Screen->>StateFlow: Stop collecting
StateFlow->>StateFlow: Last collector gone, stop immediately (stopTimeoutMillis=0)
StateFlow->>Repository: Cancel upstream flow
Note over StateFlow,Repository: replayExpirationMillis=0 prevents caching
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6 files reviewed, 1 comment
- Use onStart{} operator to emit loading state each time flow is collected
- Set replayExpirationMillis=0 to prevent stale cached values
- Add loading state handling for Network tab (Paging3)
- Update tests to work with new ChatsState/ContactsState wrappers
Closes #341
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
42de5dd to
a9c514a
Compare
Summary
onStart {}operator to emit loading state each time a flow is collectedreplayExpirationMillis = 0to prevent stale cached values being shownloadState.refresh)Changes
LoadingNetworkStatecomposable for Paging3 loading detectionCloses #341
Test plan
🤖 Generated with Claude Code