Skip to content

feat(code): add additional directories UI button#2418

Open
adboio wants to merge 1 commit into
mainfrom
05-28-feat_code_add_additional_directories_ui_button
Open

feat(code): add additional directories UI button#2418
adboio wants to merge 1 commit into
mainfrom
05-28-feat_code_add_additional_directories_ui_button

Conversation

@adboio
Copy link
Copy Markdown
Contributor

@adboio adboio commented May 28, 2026

Problem

we have /add-dir but there's no way to start a task with multiple dirs

Changes

  • adds a button on the new task page to add more directories
  • updated store so the source of truth is now the per-task workspaces.additional_directories table, not the defaults table
  • defaults table is now used as a template for new tasks, new tasks start with the additional dirs UI pre-populated from this template
  • migration to copy defaults into each workspace

addl-dirs.mp4 (uploaded via Graphite)

How did you test this?

manually

Publish to changelog?

yes

Copy link
Copy Markdown
Contributor Author

adboio commented May 28, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@adboio adboio requested review from a team and jonathanlab May 28, 2026 16:18
@adboio adboio force-pushed the 05-28-feat_code_add_additional_directories_ui_button branch from 3265d11 to 374d51d Compare May 28, 2026 16:19
@adboio adboio marked this pull request as ready for review May 28, 2026 16:19
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 28, 2026

Prompt To Fix All With AI
Fix 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

Comment on lines +36 to +50
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]);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant