diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index 1d7ed957eed1..d2c0022e3d03 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -1593,6 +1593,9 @@ function orderOptions(options: ReportUtils.OptionData[], searchValue: string | u options, [ (option) => { + if (option.isSelfDM) { + return 0; + } if (preferChatroomsOverThreads && option.isThread) { return 4; } @@ -1812,6 +1815,7 @@ function getOptions( // Sorting the reports works like this: // - Order everything by the last message timestamp (descending) + // - When searching, self DM is put at the top // - All archived reports should remain at the bottom const orderedReportOptions = lodashSortBy(filteredReportOptions, (option) => { const report = option.item; @@ -1819,6 +1823,10 @@ function getOptions( return CONST.DATE.UNIX_EPOCH; } + if (searchValue) { + return [option.isSelfDM, report?.lastVisibleActionCreated]; + } + return report?.lastVisibleActionCreated; }); orderedReportOptions.reverse();