Do not copy all emojis in recentEmoji getter #340

Merged
floatingghost merged 1 commit from sn0w/akkoma-fe:feature/optimize-recent-emojis into develop 2023-09-25 13:24:13 +00:00

View file

@ -37,11 +37,18 @@ const recentEmojis = {
getters: { getters: {
recentEmojis: (state, getters, rootState) => state.emojis.reduce((objects, displayText) => { recentEmojis: (state, getters, rootState) => state.emojis.reduce((objects, displayText) => {
const allEmojis = rootState.instance.emoji.concat(rootState.instance.customEmoji) let comparator = emoji => emoji.displayText === displayText
let emojiObject = allEmojis.find(emoji => emoji.displayText === displayText)
let emojiObject = rootState.instance.emoji.find(comparator)
if (emojiObject !== undefined) { if (emojiObject !== undefined) {
objects.push(emojiObject) objects.push(emojiObject)
} else {
emojiObject = rootState.instance.customEmoji.find(comparator)
if (emojiObject !== undefined) {
objects.push(emojiObject)
}
} }
return objects return objects
}, []), }, []),
}, },