Summary
After clearing a 1:1 channel's history for the current user with channel.hide(userId, true) (clearHistory) and then making it visible again with channel.show(userId), a subsequent client.queryChannels(..., { message_limit: N }) returns messages that were created before the hide(clearHistory: true) call. It's unclear whether the per-user history clear is supposed to survive show(), so filing to confirm expected behavior.
Environment
stream-chat (JS client): 9.35.1
- Platform: React Native (also reproducible from the JS client generally)
Steps to reproduce
For a 1:1 messaging channel that already has several messages, acting as the current user:
// 1. Clear history for the current user, then keep the channel visible in the list.
await channel.hide(currentUserId, true); // clearHistory: true
await channel.show(currentUserId);
// 2. Later (e.g. when the channel list mounts), query channels with a message preload:
const channels = await client.queryChannels(
{ type: 'messaging', members: { $in: [currentUserId] }, member_count: 2 },
{},
{ limit: 30, message_limit: 30 },
);
const ch = channels.find(/* the same channel */);
console.log(ch.state.messages.map(m => m.created_at));
Expected
ch.state.messages contains no messages created before the hide(..., true) call (the history was cleared for this user), or the docs clarify that show() / a subsequent query is expected to restore the previously cleared history.
Actual
ch.state.messages contains the full set of pre-clear messages — every returned message has a created_at earlier than the moment hide(..., true) was called. The cleared history reappears via queryChannels with message_limit.
Notes / questions
- Is
clearHistory: true intended to be a durable per-user boundary, or is it only in effect while the channel remains hidden (i.e., does show() reset it)?
- If it is meant to be durable, should
queryChannels' message_limit preload respect that per-user cleared-history boundary the way a targeted message fetch does?
- Use case: a "Clear chat" feature that must keep the conversation visible in the list afterward (so
show() is required), which is why hide is immediately followed by show.
Thanks!
Summary
After clearing a 1:1 channel's history for the current user with
channel.hide(userId, true)(clearHistory) and then making it visible again withchannel.show(userId), a subsequentclient.queryChannels(..., { message_limit: N })returns messages that were created before thehide(clearHistory: true)call. It's unclear whether the per-user history clear is supposed to surviveshow(), so filing to confirm expected behavior.Environment
stream-chat(JS client): 9.35.1Steps to reproduce
For a 1:1
messagingchannel that already has several messages, acting as the current user:Expected
ch.state.messagescontains no messages created before thehide(..., true)call (the history was cleared for this user), or the docs clarify thatshow()/ a subsequent query is expected to restore the previously cleared history.Actual
ch.state.messagescontains the full set of pre-clear messages — every returned message has acreated_atearlier than the momenthide(..., true)was called. The cleared history reappears viaqueryChannelswithmessage_limit.Notes / questions
clearHistory: trueintended to be a durable per-user boundary, or is it only in effect while the channel remains hidden (i.e., doesshow()reset it)?queryChannels'message_limitpreload respect that per-user cleared-history boundary the way a targeted message fetch does?show()is required), which is whyhideis immediately followed byshow.Thanks!