[Bug]: File Gallery loses selected file-type filter when new messages arrive

Đang mở Phù hợp với người mới
#1,477 3 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

@PritamMishra065 đang làm issue này rồi.

Từ ngày 4/12/2026.

  • #1488 của @PritamMishra065 — đang mở

Đá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
84/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ệ
javascript, react
Lĩnh vực
frontend

Hướng nghiên cứu

Bắt đầu với packages/react/src/views/MessageAggregators/FileGallery.js và theo dõi cách selectedFilter được sử dụng khi tin nhắn thay đổi và getAllFiles() làm mới danh sách. Thêm một kiểm thử hồi quy cho trường hợp danh sách tin nhắn thay đổi khi một loại tệp đang được chọn. Hoàn thành khi danh sách thả xuống và các tệp được hiển thị vẫn đồng bộ sau khi có tin nhắn mới.

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

Mô tả

bug
Description

The File Gallery does not preserve the selected file-type filter when new messages arrive in the chat.

When the message list updates, FileGallery fetches all files without considering the currently selected filter. As a result, files of other types may appear while the dropdown continues to display the selected file type.

Steps to reproduce
  1. Open EmbeddedChat and navigate to a channel containing different types of file attachments.
  2. Open the Files sidebar.
  3. Select a specific file type, such as Images.
  4. Send or receive a new message in the channel.
  5. Observe the files displayed in the sidebar.
Expected behavior

The File Gallery should preserve the selected file-type filter when new messages arrive and display only files matching the selected type.

Actual behavior

Based on source code inspection, the file list is refreshed without applying the selected filter, potentially displaying files of all types.

Root cause

The useEffect in FileGallery.js calls getAllFiles() with an empty type filter whenever the messages array changes, regardless of the selectedFilter state.

Proposed solution
  • Preserve the selected file-type filter during automatic refreshes.
  • Keep the filter dropdown and displayed file list synchronized.
  • Add regression tests to verify filter persistence.
Relevant file

packages/react/src/views/MessageAggregators/FileGallery.js

Additional context

I would like to work on this issue and submit a PR if the maintainers approve the proposed solution.

Ngôn ngữ chính
JavaScript
Star
171
Fork
421
Merge trung bình
3 ngày 6 giờ
Pull request đã merge (30 ngày)
4

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

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

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 RocketChat/EmbeddedChat

Tất cả issue của RocketChat/EmbeddedChat

Issue tương tự

Thêm issue về JavaScript

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.