Repository navigation
fix: notify channel state subscribers on watcher, ban and member removal events - #1977
Merged
Merged
Conversation
…val events Watcher events (user.watching.start/stop, user.updated), ban events (user.banned/unbanned) and the watchers loaded by a channel query wrote into the current watchers/members objects, so subscribers comparing by reference never saw the change. They now publish new objects. member.removed for the current user now also resets membership. Refs REACT-1324
MartinCupela
requested review from
isekovanic and
oliverlaz
and removed request for
isekovanic
November 2, 2026 09:56
isekovanic
reviewed
Nov 2, 2026
isekovanic
approved these changes
Nov 2, 2026
isekovanic
left a comment
Contributor
There was a problem hiding this comment.
lgtm, have a look at the comment if you have the time (more a question than a complaint about something)
The spec documents event.user on member.removed as the user who removed the member, so the removed user's id now comes from event.member and falls back to event.user. Refs REACT-1324
isekovanic
approved these changes
Nov 2, 2026
github-actions Bot
pushed a commit
that referenced
this pull request
Nov 2, 2026
## [10.0.0-rc.30](v10.0.0-rc.29...v10.0.0-rc.30) (2026-11-02) ### Bug Fixes * handle user.updated in threads ([#1979](#1979)) ([9064ffc](9064ffc)) * notify channel state subscribers on watcher, ban and member removal events ([#1977](#1977)) ([3a7be78](3a7be78)) * optimistic updates for translated messages ([#1975](#1975)) ([91fc290](91fc290)) * restore composer custom data from drafts and edits, keep custom on edit ([#1978](#1978)) ([51ddcad](51ddcad)) * unread snapshot count, pinned replies, joined and invite filters, read events check ([#1981](#1981)) ([1247d10](1247d10))
|
🎉 This PR is included in version 10.0.0-rc.30 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
CLA
Description of the changes, What, Why and How?
Linear: REACT-1324
What: some channel events changed
channel.statewithout notifying subscribers, so the UI didn't update.Why: these handlers wrote into the
watchers/membersobjects already held in the store. A subscriber that compares by reference (useStateStore(channel.state, (s) => ({ watchers: s.watchers }))) saw the same object and did not re-render. This is why the channel-list row's Unblock label does not update (REACT-1268).How: each handler now assigns a new object:
user.watching.start/user.updated/user.watching.stop: a newwatchersobject. A stop for a user who isn't watching publishes nothing.user.banned/user.unbanned: a newmembersobject. The two branches are merged into one._initializeState: query-loaded watchers are merged into a new object and published once. An empty list publishes nothing.member.removedfor the current user now resetsmembershipto{}, the value it starts with. Before, it kept the removed membership.The
#watchers-members-in-placeitem inai-docs/v10-followups.mdis marked solved.Not changed here (already there before this PR):
membership.members[me]but notmembership.banned.Tests: new tests in
test/unit/channel.test.jscheck both the new value and whether subscribers were notified. Without the fix, the watcher, ban, query and membership tests fail.Changelog
channel.statesubscribers, andmember.removedkeeping the current user'smembership.