Repository navigation
Fix the older messages spinner getting stuck while scrolling up - #6759
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
SDK Size Comparison 📏
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (6)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. WalkthroughChannel queries now run start callbacks only for the call that executes a shared request. Pagination starts only for eligible queries and ends after result application. Pagination state updates preserve loading flags for other in-flight query types, including when a result fails. ChangesChannel Query and Pagination
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant Caller
participant ChannelLogicImpl
participant ChatClient
participant MessagesPaginationManagerImpl
Caller->>ChannelLogicImpl: queryChannel
ChannelLogicImpl->>ChatClient: queryChannelWithStart
ChatClient->>ChannelLogicImpl: execute start callback
ChannelLogicImpl->>MessagesPaginationManagerImpl: begin eligible pagination
ChatClient-->>ChannelLogicImpl: query result
ChannelLogicImpl->>ChannelLogicImpl: apply query result
ChannelLogicImpl->>MessagesPaginationManagerImpl: end pagination with result
ChannelLogicImpl-->>Caller: return query result
Suggested reviewers: Merge Risk: ⚪ Minimal · up to No confirmed issue remains that should prevent merging. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit watched the pages flow, Comment |
andremion
left a comment
There was a problem hiding this comment.
Looks good. One small nit inline, optional.
|



Goal
Fix the older messages spinner getting stuck while scrolling up. Once stuck, the channel could no longer load older messages until the screen was reopened.
A page request fired while the previous page's result was still being applied repeated the previous cursor. It joined the identical request already in flight and got its result, but its
begin()never got anend(), so the loading flag stayed set.Closes AND-1557
Implementation
begin()inside the shared query call, through an internalChatClient.queryChannelWithStart, so a request that joins one in flight skips bothbegin()andend().onQueryChannelResultcallsend()after the page is applied, so the next request reads the new oldest message.MessagesPaginationManagerImpl.begin()andend()update the state atomically, and eachend()clears only its own query's loading flag. A plain watch finishing during a page load no longer overwrites the page's result, and a newer page no longer hides the older page spinner.begin()as they already skippedend().Testing
Unit tests cover a request joining an identical one in flight,
end()running after the page is applied, and overlappingbegin()/end()calls in the pagination manager.On a device, flick-scrolling up through about 250 pages: a request joined one in flight 8 times and the spinner never stuck. Before the fix, the same scrolling left it stuck.
🤖 Generated with Claude Code
Summary by CodeRabbit