bug: A second date separator ("Today") appears where unread messages start

未關閉 適合新手
#3,467 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
72/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
react, typescript
領域
frontend

研究方向

從 src/components/MessageList/utils.ts 的 processMessages 開始,額外的日期分隔符會插入在標記為 unread: true 的第一則未讀訊息之前。然後檢查 DateSeparator.tsx,其中說明 unread 沒有作用。透過渲染啟用日期分隔符且未讀訊息從一天中途開始的 MessageList 來重現。當每天只出現一個日期分隔符,且未讀位置仍由 UnreadMessagesSeparator 標記時,即完成。

由索引模型根據 Issue 內容生成。

描述

Describe the bug

processMessages inserts an extra date separator before the first unread message from another user, marked unread: true. In v15, DateSeparator documents unread as "Has no effect", so this separator renders exactly like an ordinary date separator. If the unread messages start partway through a day, the list shows the date twice: once at the start of the day, and again ("Today") in the middle of it, above the UnreadMessagesSeparator.

To Reproduce

  1. Use <MessageList /> with its defaults (date separators on).
  2. In a channel, have another user send several messages today. Read them.
  3. Have that user send more messages today while you're away from the channel.
  4. Open the channel. "Today" appears at the start of today's messages, and a second "Today" appears where the unread messages start.

Expected behavior

One date separator per day. The unread position is marked by UnreadMessagesSeparator, so the extra separator isn't needed, or it should render differently from an ordinary date separator.

Our workaround

We pass hideNewMessageSeparator to MessageList. That prop only turns off this extra date separator; UnreadMessagesSeparator still renders. The prop name suggests it hides the "new messages" separator itself, which is what made this hard to find.

Package version

  • stream-chat-react: 15.0.0. The same code is in 15.0.2, checked in source (processMessages in src/components/MessageList/utils.ts, and DateSeparator.tsx).
  • stream-chat-js: 10.0.1

Desktop

  • Chrome on macOS

Additional context

App id: 67855

主要語言
TypeScript
星號
845
分支
295
平均合併
1 天 8 小時
30 天內合併 PR
106

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

GetStream/stream-chat-react 的其他 Issue

查看 GetStream/stream-chat-react 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。