Revert "Add generic searchable list to back settings and extensions"#19029
Revert "Add generic searchable list to back settings and extensions"#19029
Conversation
Summary of ChangesHello @chrstnb, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request performs a complete revert of a previous change that aimed to introduce a generic searchable list component. The revert removes all associated code, effectively eliminating the fuzzy search capabilities and the Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Size Change: +18.3 kB (+0.07%) Total Size: 24.4 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request reverts the generic searchable list abstraction and restores the search logic directly within the SettingsDialog component. While the revert aims to restore previous functionality, it introduces a few regressions in robustness and edge-case handling, particularly regarding error handling in asynchronous search operations and viewport width calculations on small terminals. The use of magic numbers in layout calculations should also be addressed for better maintainability.
| const doSearch = async () => { | ||
| const results = await fzfInstance.find(searchQuery); | ||
|
|
||
| if (!active) return; | ||
|
|
||
| const matchedKeys = new Set<string>(); | ||
| results.forEach((res: FzfResult) => { | ||
| const key = searchMap.get(res.item.toLowerCase()); | ||
| if (key) matchedKeys.add(key); | ||
| }); | ||
| setFilteredKeys(Array.from(matchedKeys)); | ||
| }; | ||
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-floating-promises | ||
| doSearch(); |
There was a problem hiding this comment.
The asynchronous search operation lacks error handling. If fzfInstance.find fails (e.g., due to an internal worker error), the search will fail silently, leaving the filtered list in a stale state. It is recommended to add a .catch() block to handle potential rejections and reset the filtered keys to a safe default.
| const doSearch = async () => { | |
| const results = await fzfInstance.find(searchQuery); | |
| if (!active) return; | |
| const matchedKeys = new Set<string>(); | |
| results.forEach((res: FzfResult) => { | |
| const key = searchMap.get(res.item.toLowerCase()); | |
| if (key) matchedKeys.add(key); | |
| }); | |
| setFilteredKeys(Array.from(matchedKeys)); | |
| }; | |
| // eslint-disable-next-line @typescript-eslint/no-floating-promises | |
| doSearch(); | |
| const doSearch = async () => { | |
| try { | |
| const results = await fzfInstance.find(searchQuery); | |
| if (!active) return; | |
| const matchedKeys = new Set<string>(); | |
| results.forEach((res: FzfResult) => { | |
| const key = searchMap.get(res.item.toLowerCase()); | |
| if (key) matchedKeys.add(key); | |
| }); | |
| setFilteredKeys(Array.from(matchedKeys)); | |
| } catch (error) { | |
| setFilteredKeys(getDialogSettingKeys()); | |
| } | |
| }; |
Reverts #18838