Emoji loading performance (#38784)

This commit is contained in:
Echo authored and GitHub committed 2026-04-23 07:48:00 +00:00
1 parent fdb2563abf
commit 5bc69ea668
7 files changed
+67 -23

No files matched your search

@@ -185,21 +185,16 @@ export function cleanExtraEmojis(extraEmojis?: CustomEmojiMapArg | null) {
if (!extraEmojis) {
return null;
}
if (Array.isArray(extraEmojis)) {
return extraEmojis.reduce<ExtraCustomEmojiMap>(
(acc, emoji) => ({ ...acc, [emoji.shortcode]: emoji }),
{},
);
if (!Array.isArray(extraEmojis) && !isList(extraEmojis)) {
return extraEmojis;
}
if (isList(extraEmojis)) {
return extraEmojis
.toJS()
.reduce<ExtraCustomEmojiMap>(
(acc, emoji) => ({ ...acc, [emoji.shortcode]: emoji }),
{},
);
const emojis: ExtraCustomEmojiMap = {};
const emojiArray = isList(extraEmojis) ? extraEmojis.toJS() : extraEmojis;
for (const emoji of emojiArray) {
emojis[emoji.shortcode] = emoji;
}
return extraEmojis;
return emojis;
}
/**