opencode
opencode copied to clipboard
fix(web): open project dialog not showing directories
Summary
- Fix "Open project" dialog showing "No folders found" in web mode
- Related to #6307 (closed but fix was incomplete)
Problem
Three issues prevented the Open Project dialog from working:
-
Server:
queryparameter was required but SDK sends empty string asundefined, causing 400 Bad Request -
Server:
directoryparameter was ignored, always searching current project directory instead of home -
UI:
useFilteredListhook didn't properly handle async items function, causing Promise to be used as array
Changes
packages/opencode/src/server/server.ts
- Make
queryparameter optional with default empty string - Add
directoryparameter support to/find/fileendpoint - Implement directory scanning when
directoryparam is provided (2 levels deep)
packages/ui/src/hooks/use-filtered-list.tsx
- Fix
createResourcesource function to not call async functions synchronously - Properly await async items function in fetcher
packages/app/src/components/dialog-select-directory.tsx
- Add null-safety to
filter.trim()call
Testing
Tested locally with opencode web - dialog now shows home directories and search works correctly.