fix(ui): handle async items function in useFilteredList hook #8157
+8
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.itemsis an async function (like in the@autocomplete which callsfiles.searchFilesAndDirectories), theuseFilteredListhook's source function calls it without arguments. This returns a Promise, which is then passed to the fetcher asitems. Since Promise is truthy, the fallback logicitems ?? await props.items(needle)didn't trigger, causing the code to iterate over a Promise object instead of an array.Fix:
Check if
itemsis 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?
npm run typecheck- passesFixes #8148
🤖 Generated with Claude Code