Skip to content

v9.11.1-beta.2

@isekovanic isekovanic tagged this 28 Oct 22:03
## 🎯 Goal

Fixes https://github.com/GetStream/stream-chat-react-native/issues/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 06e1be316, together with
GetStream/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 06e1be316, 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 65b9bf574,
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 7e6b5e7b5 with the same prefill
`MessageList` has.

## 🎨 UI Changes

/

## 🧪 Testing

/

## ☑️ Checklist

- [ ] I have signed the [Stream
CLA](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform)
(required)
- [x] 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
Assets 2
Loading