Skip to content

Conversation

@zerone0x
Copy link
Contributor

What does this PR do?

Fixes the empty file list issue when trying to tag files/folders in chat via the @ mention autocomplete (issue #8148).

Root Cause:
When props.items is an async function (like in the @ autocomplete which calls files.searchFilesAndDirectories), the useFilteredList hook's source function calls it without arguments. This returns a Promise, which is then passed to the fetcher as items. Since Promise is truthy, the fallback logic items ?? await props.items(needle) didn't trigger, causing the code to iterate over a Promise object instead of an array.

Fix:
Check if items is a Promise or not an array, and if so, properly call the async function with the filter parameter.

How did you verify your code works?

  • Ran npm run typecheck - passes
  • Analyzed the code flow to confirm the fix handles the async case properly

Fixes #8148


🤖 Generated with Claude Code

When props.items is an async function, calling it in the source function
without arguments returns a Promise. This Promise was then passed directly
to the fetcher as 'items', but since Promise is truthy, the fallback
`items ?? await props.items(needle)` didn't trigger, causing the code
to try iterating over a Promise object instead of an array.

This fix checks if items is a Promise or not an array, and if so, properly
calls the async function with the filter parameter.

Fixes anomalyco#8148

Co-Authored-By: Claude <[email protected]>
@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@adamdotdevin
Copy link
Contributor

Thanks for this, we resolved this morning!

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.

[WINDOWS] Empty list when trying to tag a file/folder in chat

2 participants