Users

Muted and blocked users are reactive stores on the client. The current user and other users the client has seen are plain objects.

Initialization

client.connectUser() fetches them.

Reading

// The current user (not reactive, updated on `user.updated`)
const currentUser = client.user;

// Any user the client has seen (not reactive)
const otherUser = client.state.users[otherUserId];

// Muted users
const { mutedUsers } = client.mutedUsersStore.getLatestValue();

// Blocked user ids
const { userIds } = client.blockedUsers.getLatestValue();

Subscribe to render changes:

const unsubscribeMutes = client.mutedUsersStore.subscribe(({ mutedUsers }) =>
  renderMutedUsers(mutedUsers),
);

const unsubscribeBlocks = client.blockedUsers.subscribe(({ userIds }) =>
  renderBlockedUsers(userIds),
);