stream-chat-js
stream-chat-js copied to clipboard
Update partial and query do not update channel.data
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()