From c578f40ad8201a75efe6bfee22f0ffd7cb938640 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Fri, 17 Jul 2020 16:27:21 +0100 Subject: [PATCH] Sort recent emoji in descending order Fixes https://github.com/vector-im/riot-web/issues/14594 --- src/emojipicker/recent.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/emojipicker/recent.ts b/src/emojipicker/recent.ts index e3977faadd..1ba15d87b8 100644 --- a/src/emojipicker/recent.ts +++ b/src/emojipicker/recent.ts @@ -16,7 +16,7 @@ limitations under the License. */ import SettingsStore, {SettingLevel} from "../settings/SettingsStore"; -import {sortBy} from "lodash"; +import {orderBy} from "lodash"; interface ILegacyFormat { [emoji: string]: [number, number]; // [count, date] @@ -68,6 +68,6 @@ export function get(limit = 24) { } // perform a stable sort on `count` to keep the recent (date) order as a secondary sort factor - const sorted = sortBy(recents, "1"); + const sorted = orderBy(recents, "1", "desc"); return sorted.slice(0, limit).map(([emoji]) => emoji); }