Popup: sort whitelist domains alphabetically before rendering#47
Popup: sort whitelist domains alphabetically before rendering#47
Conversation
Co-authored-by: ormidales <46538211+ormidales@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Cette PR améliore la lisibilité de la liste blanche dans la popup en affichant les domaines par ordre alphabétique (insensible à la casse) avant le rendu, afin de faciliter la recherche et la suppression d’entrées.
Changes:
- Tri alphabétique insensible à la casse des domaines dans
renderListavant génération du DOM. - Tri effectué sur une copie du tableau pour éviter de muter la valeur issue du storage.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const domains = await getStoredDomains(); | ||
| const sortedDomains = [...domains].sort((a, b) => | ||
| a.localeCompare(b, undefined, { sensitivity: "base" }) | ||
| ); |
There was a problem hiding this comment.
sortedDomains is built by calling a.localeCompare(...), but getStoredDomains() only validates that the stored value is an array (not that its elements are strings). If sync storage ever contains non-string entries (e.g., corrupted/legacy data), this will throw and break the popup rendering. Consider normalizing first (filter typeof === "string", trim(), optionally lowercase for display/sort consistency) and then sorting the sanitized list (similar to updateExceptionDomains in background.js).
La popup affichait les domaines en ordre d’ajout, ce qui rendait la recherche/suppression difficile dès que la liste grandissait. Cette PR aligne l’UI sur le besoin de lisibilité en triant la liste blanche par ordre alphabétique.
What changed
renderListdanspopup.jstrie désormais les domaines avant génération du DOM.Alpha.com,beta.com,zeta.com).[...domains]) pour éviter toute mutation de la valeur récupérée depuis le storage.Implementation (minimal diff)
UI impact
Screenshot

Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.