logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git
commit: c4352a1936b2bcb3ea4bf5534646ce39eec7e3e7
parent 6bc020c733047d7033e508a2b4dffc581d703170
Author: Henry Jameson <me@hjkos.com>
Date:   Tue, 13 Aug 2024 22:51:17 +0300

cache emoji groups etc

Diffstat:

Msrc/modules/instance.js24+++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/src/modules/instance.js b/src/modules/instance.js @@ -145,6 +145,10 @@ const defaultState = { quotingAvailable: false, groupActorAvailable: false, + // Emoji stuff + standardEmojiList: null, + standardEmojiGroupList: null, + // Html stuff instanceSpecificPanelContent: '', tos: '', @@ -246,15 +250,21 @@ const instance = { }, {}) }, standardEmojiList (state) { - return SORTED_EMOJI_GROUP_IDS - .map(groupId => (state.emoji[groupId] || []).map(k => injectAnnotations(k, state.unicodeEmojiAnnotations))) - .reduce((a, b) => a.concat(b), []) + if (!state.standardEmojiList) { + state.standardEmojiList = SORTED_EMOJI_GROUP_IDS + .map(groupId => (state.emoji[groupId] || []).map(k => injectAnnotations(k, state.unicodeEmojiAnnotations))) + .reduce((a, b) => a.concat(b), []) + } + return state.standardEmojiList }, standardEmojiGroupList (state) { - return SORTED_EMOJI_GROUP_IDS.map(groupId => ({ - id: groupId, - emojis: (state.emoji[groupId] || []).map(k => injectAnnotations(k, state.unicodeEmojiAnnotations)) - })) + if (!state.standardEmojiGroupList) { + state.standardEmojiGroupList = SORTED_EMOJI_GROUP_IDS.map(groupId => ({ + id: groupId, + emojis: (state.emoji[groupId] || []).map(k => injectAnnotations(k, state.unicodeEmojiAnnotations)) + })) + } + return state.standardEmojiGroupList }, instanceDomain (state) { return new URL(state.server).hostname