fix: increasing/decreasing member count on member event cause incorrect member count#1761
Open
szuperaz wants to merge 3 commits into
Open
fix: increasing/decreasing member count on member event cause incorrect member count#1761szuperaz wants to merge 3 commits into
szuperaz wants to merge 3 commits into
Conversation
MartinCupela
requested changes
Jun 2, 2026
Contributor
MartinCupela
left a comment
There was a problem hiding this comment.
@szuperaz could you add tests for this, please?
Contributor
Author
Do you mean a negative test checking we don't change counter on member events? |
Contributor
Author
Contributor
|
Size Change: -148 B (-0.04%) Total Size: 393 kB 📦 View Changed
|
MartinCupela
approved these changes
Jun 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The issue:
When adding more than one member at once to a channel, this is the WS event sequence I get:
member.addedevent arrives -> stream-chat-js increases member count by one, current value is 5channel.updatedevent arrives with member count 6 -> stream-chat-js sets member count from WS event to 6member.addedevent arrives -> stream-chat-js increases member count by one, current value is 7 ❌The solution:
Since
channel.updatedis dispatched every time we add/remove members, it's safe to set member count only from that event, and don't increase/decrease counter on member events.CLA
Description of the changes, What, Why and How?
Changelog