opencode icon indicating copy to clipboard operation
opencode copied to clipboard

fix(web): open project dialog not showing directories

Open lxxonx opened this issue 2 days ago • 2 comments

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:

  1. Server: query parameter was required but SDK sends empty string as undefined, causing 400 Bad Request
  2. Server: directory parameter was ignored, always searching current project directory instead of home
  3. UI: useFilteredList hook didn't properly handle async items function, causing Promise to be used as array

Changes

packages/opencode/src/server/server.ts

  • Make query parameter optional with default empty string
  • Add directory parameter support to /find/file endpoint
  • Implement directory scanning when directory param is provided (2 levels deep)

packages/ui/src/hooks/use-filtered-list.tsx

  • Fix createResource source 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.

lxxonx avatar Jan 13 '26 10:01 lxxonx