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

Đang mở Phù hợp với người mới
#3,467 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
react, typescript
Lĩnh vực
frontend

Hướng nghiên cứu

Bắt đầu trong src/components/MessageList/utils.ts tại processMessages, nơi dấu phân cách ngày bổ sung được chèn trước tin nhắn chưa đọc đầu tiên được đánh dấu unread: true. Sau đó kiểm tra DateSeparator.tsx, tệp ghi chú rằng unread không có tác dụng. Tái hiện bằng cách render MessageList với dấu phân cách ngày được bật và các tin nhắn chưa đọc bắt đầu từ giữa một ngày. Hoàn thành khi chỉ có một dấu phân cách ngày xuất hiện mỗi ngày và vị trí chưa đọc vẫn được đánh dấu bởi UnreadMessagesSeparator.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
TypeScript
Star
845
Fork
295
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
106

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của GetStream/stream-chat-react

Tất cả issue của GetStream/stream-chat-react

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.