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

オープン 初心者向け
#3,467 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
react, typescript
領域
frontend

調査の方向性

src/components/MessageList/utils.ts の processMessages から始めます。ここでは、unread: true とマークされた最初の未読メッセージの前に追加の日付セパレーターが挿入されます。次に DateSeparator.tsx を確認します。これは unread が効果を持たないことを文書化しています。日付セパレーターを有効にし、未読メッセージが一日の途中から始まる状態で MessageList をレンダリングして再現します。1 日につき日付セパレーターが 1 つだけ表示され、未読位置が引き続き 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時間
マージ済み PR(30日)
106

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

GetStream/stream-chat-react のほかの issue

GetStream/stream-chat-react の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。