Skip to content

Commit b692949

Browse files
authored
Merge pull request #87367 from Expensify/claude-cmdKSearchMissesWorkspaceMembers
2 parents a87e6d1 + cf87744 commit b692949

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

src/components/Search/SearchAutocompleteList.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,13 @@ function SearchAutocompleteList({
410410
data: nextStyledRecentReports,
411411
sectionIndex: sectionIndex++,
412412
});
413+
} else if (autocompleteQueryValue.trim() !== '' && nextStyledRecentReports.length > 0) {
414+
// When options aren't fully initialized but we have a search query with available results,
415+
// render them immediately so they're selectable instead of hiding the section entirely.
416+
pushSection({
417+
data: nextStyledRecentReports,
418+
sectionIndex: sectionIndex++,
419+
});
413420
} else if (autocompleteQueryValue.trim() === '') {
414421
pushSection({
415422
title: translate('search.recentChats'),

src/libs/OptionsListUtils/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2663,8 +2663,12 @@ function getValidOptions(
26632663
return searchTerms.every((term) => searchText.includes(term));
26642664
};
26652665

2666-
// when we expect that function return eg. 50 elements and we already found 40 recent reports, we should adjust the max personal details number
2667-
const maxPersonalDetailsElements = maxElements ? Math.max(maxElements - recentReportOptions.length - workspaceChats.length - (!selfDMChat ? 1 : 0), 0) : undefined;
2666+
// when we expect that function return eg. 50 elements and we already found 40 recent reports, we should adjust the max personal details number.
2667+
// Always guarantee a minimum number of personalDetails slots so that workspace members without an existing DM report remain visible.
2668+
const MIN_PERSONAL_DETAILS_SLOTS = 5;
2669+
const maxPersonalDetailsElements = maxElements
2670+
? Math.max(maxElements - recentReportOptions.length - workspaceChats.length - (!selfDMChat ? 1 : 0), MIN_PERSONAL_DETAILS_SLOTS)
2671+
: undefined;
26682672
personalDetailsOptions = optionsOrderBy(options.personalDetails, personalDetailsComparator, maxPersonalDetailsElements, filteringFunction, true);
26692673

26702674
for (let i = 0; i < personalDetailsOptions.length; i++) {

0 commit comments

Comments
 (0)