diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 3aa4cb63df9a..cc523cce748f 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -164,8 +164,11 @@ function getOrderedReportIDs( if (isInDefaultMode) { nonArchivedReports.sort((a, b) => { const compareDates = a?.lastVisibleActionCreated && b?.lastVisibleActionCreated ? compareStringDates(b.lastVisibleActionCreated, a.lastVisibleActionCreated) : 0; + if (compareDates) { + return compareDates; + } const compareDisplayNames = a?.displayName && b?.displayName ? localeCompare(a.displayName, b.displayName) : 0; - return compareDates || compareDisplayNames; + return compareDisplayNames; }); // For archived reports ensure that most recent reports are at the top by reversing the order archivedReports.sort((a, b) => (a?.lastVisibleActionCreated && b?.lastVisibleActionCreated ? compareStringDates(b.lastVisibleActionCreated, a.lastVisibleActionCreated) : 0));