Skip to content

fix: offline message limit pagination - #3907

Merged
isekovanic merged 4 commits into
developfrom
fix/offline-message-limit-pagination
Oct 28, 2026
Merged

isekovanic merged 4 commits into
developfrom
fix/offline-message-limit-pagination

Conversation

@isekovanic

@isekovanic isekovanic commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

🎯 Goal

Fixes #3903 and the related pagination problems found while testing it.

Linear ticket: https://linear.app/stream/issue/RN-471/offline-support-channels-hydrated-from-the-local-db-get-hasprev-false

With offline support, channels hydrated from the offline DB could end up with hasPrev = false even when the server has older messages, so scrolling up never requests them. The offline DB returns at most 24 messages per channel (RowNum < 25).

Testing it also showed that the message lists stop paginating after a single failed request and that MessageFlashList cannot load older messages when the loaded ones do not fill the screen.

πŸ›  Implementation details

  • Channels loaded from the offline DB can get hasPrev = false when the server still has older messages, so scrolling up never loads them. The offline DB returns at most 24 messages per channel and ignores the list's message_limit, so the client reads a short cached page as the start of the channel. Fixed in 06e1be3, together with fix: read cached channels against the query's message_limitΒ stream-chat-js#1958. The offline DB now returns the newest message_limit messages per channel (25 when not set), and the client reads that page against the same limit.
  • The offline DB can show messages with gaps between them. If messages 1-10 were cached in one session and 16-25 in a later one, they show up back to back with 11-15 missing. Fixed in 06e1be3, since only the newest message_limit messages are read now.
  • After a failed request (offline, timeout or w/e), MessageList and MessageFlashList stop paginating until the number of messages changes. loadMore, loadMoreRecent and loadMoreThread swallow their errors, so the lists treat the failure as a successful load. Fixed in 65b9bf5, so if a load adds nothing the list tries again on the next scroll after a 2 second backoff.
  • MessageFlashList can't load older messages when the loaded ones don't fill the screen, because it only paginates on scroll events and a list that short can't scroll. Fixed in 7e6b5e7 with the same prefill MessageList has.

🎨 UI Changes

/

πŸ§ͺ Testing

/

β˜‘οΈ Checklist

  • I have signed the Stream CLA (required)
  • PR targets the develop branch
  • Documentation is updated
  • New code is tested in main example apps, including all possible scenarios
    • SampleApp iOS and Android
    • Expo iOS and Android

@Stream-SDK-Bot

Copy link
Copy Markdown
Contributor

SDK Size

title develop branch diff status
js_bundle_size 2036 KB 2037 KB +1268 B 🟒
ai_components_size 163 KB 163 KB 0 B 🟒

@isekovanic
isekovanic merged commit 59528b7 into develop Oct 28, 2026
12 of 13 checks passed
@isekovanic
isekovanic deleted the fix/offline-message-limit-pagination branch October 28, 2026 22:03
isekovanic added a commit that referenced this pull request Oct 29, 2026
## 🎯 Goal

Fixes #3903
on V10. This is the V10 port of
#3907.

Linear ticket:
https://linear.app/stream/issue/RN-471/offline-support-channels-hydrated-from-the-local-db-get-hasprev-false

## πŸ›  Implementation details

- Channels loaded from the offline DB can look fully loaded when the
server still has older messages, so scrolling up never loads them. The
offline DB returns at most 24 messages per channel and ignores the
list's `message_limit`. Fixed in `selectMessagesForChannels` together
with <LLC PR link>. The offline DB now returns the newest
`message_limit` messages per channel (25 when not set), and the client
reads that page against the same limit.
- The offline DB can show messages with gaps between them. If messages
1-10 were cached in one session and 16-25 in a later one, they show up
back to back with 11-15 missing. Fixed by the same change, since only
the newest `message_limit` messages are read now.

The other two fixes from #3907 aren't needed on V10. The lists call
`loadMore()` directly, without per-length trackers that a failed request
could leave stuck. `MessageFlashList` already loads older messages from
its initial scroll event.

## 🎨 UI Changes

/

## πŸ§ͺ Testing

/

## β˜‘οΈ Checklist

- [ ] I have signed the [Stream
CLA](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform)
(required)
- [ ] PR targets the `develop` branch
- [ ] Documentation is updated
- [ ] New code is tested in main example apps, including all possible
scenarios
  - [ ] SampleApp iOS and Android
  - [ ] Expo iOS and Android
@github-actions github-actions Bot mentioned this pull request Oct 29, 2026
6 tasks
@stream-ci-bot

Copy link
Copy Markdown
Contributor

πŸŽ‰ This PR is included in version 9.11.1 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

πŸ”₯ [πŸ›] Offline support: channels hydrated from the local DB get hasPrev = false, so older messages never load

4 participants