stream-chat-js icon indicating copy to clipboard operation
stream-chat-js copied to clipboard

Update partial and query do not update channel.data

Open mfbx9da4 opened this issue 3 years ago • 0 comments

This can lead to bugs due to bad caching.

The channel.data is updated after

  • Updating the channel https://github.com/GetStream/stream-chat-js/blob/8ad1303162eec62e52d8526f74d146e9f55f1ecb/src/channel.ts#L558
  • Watching the channel https://github.com/GetStream/stream-chat-js/blob/8ad1303162eec62e52d8526f74d146e9f55f1ecb/src/channel.ts#L744

The channel.data is not updated after

  • Partially updating the channel https://github.com/GetStream/stream-chat-js/blob/8ad1303162eec62e52d8526f74d146e9f55f1ecb/src/channel.ts#L385
  • Querying the channel https://github.com/GetStream/stream-chat-js/blob/8ad1303162eec62e52d8526f74d146e9f55f1ecb/src/channel.ts#L943

We have found this has produced hard to find bugs where the channel has stale data but is not actively being watched.

Fix: it should update channel.data after channel.updatePartial() and channel.query()

mfbx9da4 avatar Jul 05 '22 18:07 mfbx9da4