queryChannels({ message_limit }) returns history cleared via hide(clearHistory: true) after show() — expected?
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- api
Research direction
Start by reproducing the sequence with channel.hide(currentUserId, true), channel.show(currentUserId), and client.queryChannels(..., { message_limit: 30 }) using stream-chat 9.35.1. Compare the pre-clear messages returned by ch.state.messages with the intended per-user history boundary, then establish whether show() should preserve clearHistory and whether queryChannels preload should honor it; the issue is done when the behavior is clarified or corrected.
Written by the indexing model from the issue text.
Description
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: trueintended to be a durable per-user boundary, or is it only in effect while the channel remains hidden (i.e., doesshow()reset it)? - If it is meant to be durable, should
queryChannels'message_limitpreload 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 whyhideis immediately followed byshow.
Thanks!
- Dominant language
- TypeScript
- Stars
- 211
- Forks
- 84
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 89
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from GetStream/stream-chat-js
-
Error helpers in errors.ts (isAPIError, isErrorRetryable, APIErrorCodes) are not exported from the package entry pointPossibly taken @Tyagiquamar claimed this 73 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
GetStream/stream-chat-js#1848 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
GetStream/stream-chat-js#1719 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
GetStream/stream-chat-js#1967 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
GetStream/stream-chat-js#1680 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
GetStream/stream-chat-js#1668 · 5 comments ·
Maintainers usually reply within 1 day
All issues in GetStream/stream-chat-js
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
siyuan-note/siyuan#21692 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
GetStream/stream-chat-react#3467 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
resend/resend-node#1206 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
cloudflare/cloudflare-typescript#2821 ·