Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/components/Search/SearchAutocompleteList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,13 @@ function SearchAutocompleteList({
data: nextStyledRecentReports,
sectionIndex: sectionIndex++,
});
} else if (autocompleteQueryValue.trim() !== '' && nextStyledRecentReports.length > 0) {
// When options aren't fully initialized but we have a search query with available results,
// render them immediately so they're selectable instead of hiding the section entirely.
pushSection({
data: nextStyledRecentReports,
sectionIndex: sectionIndex++,
});
} else if (autocompleteQueryValue.trim() === '') {
pushSection({
title: translate('search.recentChats'),
Expand Down
8 changes: 6 additions & 2 deletions src/libs/OptionsListUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
*/

let allReports: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 217 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -230,7 +230,7 @@
const deprecatedCachedOneTransactionThreadReportIDs: Record<string, string | undefined> = {};
/** @deprecated Use sortedReportActionsData from ONYXKEYS.DERIVED.RAM_ONLY_SORTED_REPORT_ACTIONS instead. Will be removed once all flows are migrated. */
let deprecatedAllReportActions: OnyxCollection<ReportActions>;
Onyx.connect({

Check warning on line 233 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
callback: (actions) => {
Expand Down Expand Up @@ -280,7 +280,7 @@
});

let activePolicyID: OnyxEntry<string>;
Onyx.connect({

Check warning on line 283 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.NVP_ACTIVE_POLICY_ID,
callback: (value) => (activePolicyID = value),
});
Expand Down Expand Up @@ -2663,8 +2663,12 @@
return searchTerms.every((term) => searchText.includes(term));
};

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

for (let i = 0; i < personalDetailsOptions.length; i++) {
Expand Down
Loading