feat(code): add additional directories UI button#2418
Conversation
3265d11 to
374d51d
Compare
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
apps/code/src/renderer/features/folder-picker/components/AdditionalDirectoriesButton.tsx:36-50
**Badge count can exceed visible dropdown entries**
When `values` contains paths that are not yet in the local folders store (e.g., default directories loaded from `listDefaults` that were never opened via the file picker on this machine), `getFolderByPath(path)` returns falsy and the path is silently skipped. `count = values.length` includes them, so the button shows `+N`, but the dropdown lists fewer than N entries — meaning the user cannot see or deselect those "hidden" directories.
This scenario arises whenever the defaults table has a path that was added on a different machine or via a backend operation that didn't update the renderer's folders store. The fix is either to also render paths that can't be resolved through `getFolderByPath` (displaying the raw path string as a fallback), or to proactively register default directories into the folders store when they are first loaded.
Reviews (1): Last reviewed commit: "feat(code): add additional directories U..." | Re-trigger Greptile |
| const folders = useMemo(() => { | ||
| const recent = getRecentFolders().filter( | ||
| (f) => f.path !== primaryDirectory, | ||
| ); | ||
| const seen = new Set(recent.map((f) => f.path)); | ||
| for (const path of values) { | ||
| if (seen.has(path)) continue; | ||
| const folder = getFolderByPath(path); | ||
| if (folder) { | ||
| recent.push(folder); | ||
| seen.add(path); | ||
| } | ||
| } | ||
| return recent; | ||
| }, [getRecentFolders, getFolderByPath, values, primaryDirectory]); |
There was a problem hiding this comment.
Badge count can exceed visible dropdown entries
When values contains paths that are not yet in the local folders store (e.g., default directories loaded from listDefaults that were never opened via the file picker on this machine), getFolderByPath(path) returns falsy and the path is silently skipped. count = values.length includes them, so the button shows +N, but the dropdown lists fewer than N entries — meaning the user cannot see or deselect those "hidden" directories.
This scenario arises whenever the defaults table has a path that was added on a different machine or via a backend operation that didn't update the renderer's folders store. The fix is either to also render paths that can't be resolved through getFolderByPath (displaying the raw path string as a fallback), or to proactively register default directories into the folders store when they are first loaded.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/folder-picker/components/AdditionalDirectoriesButton.tsx
Line: 36-50
Comment:
**Badge count can exceed visible dropdown entries**
When `values` contains paths that are not yet in the local folders store (e.g., default directories loaded from `listDefaults` that were never opened via the file picker on this machine), `getFolderByPath(path)` returns falsy and the path is silently skipped. `count = values.length` includes them, so the button shows `+N`, but the dropdown lists fewer than N entries — meaning the user cannot see or deselect those "hidden" directories.
This scenario arises whenever the defaults table has a path that was added on a different machine or via a backend operation that didn't update the renderer's folders store. The fix is either to also render paths that can't be resolved through `getFolderByPath` (displaying the raw path string as a fallback), or to proactively register default directories into the folders store when they are first loaded.
How can I resolve this? If you propose a fix, please make it concise.
Problem
we have
/add-dirbut there's no way to start a task with multiple dirsChanges
workspaces.additional_directoriestable, not the defaults tableaddl-dirs.mp4 (uploaded via Graphite)
How did you test this?
manually
Publish to changelog?
yes