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

Offen Anfängerfreundlich
#1,477 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@PritamMishra065 arbeitet bereits daran.

Seit 04.12.2026.

  • #1488 von @PritamMishra065 — offen

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
84/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
javascript, react
Bereich
frontend

Rechercherichtung

Beginne mit packages/react/src/views/MessageAggregators/FileGallery.js und verfolge, wie selectedFilter verwendet wird, wenn sich Nachrichten ändern und getAllFiles() die Liste aktualisiert. Füge einen Regressionstest dafür hinzu, dass sich die Nachrichtenliste ändert, während ein Dateityp ausgewählt ist. Das Ziel ist erreicht, wenn Dropdown und angezeigte Dateien synchron bleiben, nachdem neue Nachrichten eingetroffen sind.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
JavaScript
Sterne
171
Forks
421
Ø Merge
3 T. 6 Std.
Gemergte PRs (30 T.)
4

Entwicklungsumgebung

  • Kein Dockerfile und keine Docker-Compose-Datei
  • Hat eine Pull-Request-Vorlage
  • Kein Beitragsleitfaden

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus RocketChat/EmbeddedChat

Alle Issues in RocketChat/EmbeddedChat

Ähnliche Issues

Weitere Issues zu JavaScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.