fix: properly sync own reads while offline mode is enabled #2901
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🎯 Goal
Fixes this Zendesk issue.
🛠 Implementation details
It appears that this underlying issue may represent itself in various manners, all appearing in integrations where
enableOfflineSupport={true}
:ChannelList
specifically is open, reading one will break the state for all otherschannel
reads get stuck in a weird state where it's not possible to trigger a readMessageList
(which count as unread) while having it open will cause these to not be counted in theChannelPreview
s if we go back to ourChannelList
Although the issues seem different, they all have the same underlying cause - the fact that we don't update reads whenever we receive new messages within the SDK, but rather we update them only whenever we query channels. This leads to the following happening:
ChannelList
ChannelList
The reason why the second channels query did not update the
ChannelList
either is due to an improper list of dependencies in our hooks as well as bad values used for memoization. So the underlying causes were 2 issues:Both of these issues should be fixed.
🎨 UI Changes
iOS
Android
🧪 Testing
☑️ Checklist
develop
branch