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

Aperta Adatta ai principianti
#1,477 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@PritamMishra065 ci sta già lavorando.

Dal 4/12/2026.

  • #1488 di @PritamMishra065 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
84/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript, react
Ambito
frontend

Direzione di ricerca

Inizia da packages/react/src/views/MessageAggregators/FileGallery.js e segui come viene utilizzato selectedFilter quando cambiano i messaggi e getAllFiles() aggiorna l’elenco. Aggiungi un test di regressione per il caso in cui l’elenco dei messaggi cambia mentre è selezionato un tipo di file. Il risultato atteso è che il menu a discesa e i file visualizzati rimangano sincronizzati dopo l’arrivo di nuovi messaggi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
JavaScript
Stelle
171
Fork
421
Merge medio
3g 6h
PR unite (30g)
4

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di RocketChat/EmbeddedChat

Tutte le issue di RocketChat/EmbeddedChat

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.