cache allShortcodes
parent
82dc98f91c
commit
827277a8cc
|
@ -213,6 +213,8 @@ export function clearComposeSuggestions() {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let allShortcodes = null; // cached list of all shortcodes for suggestions
|
||||||
|
|
||||||
export function fetchComposeSuggestions(token) {
|
export function fetchComposeSuggestions(token) {
|
||||||
let leading = token[0];
|
let leading = token[0];
|
||||||
|
|
||||||
|
@ -231,8 +233,10 @@ export function fetchComposeSuggestions(token) {
|
||||||
};
|
};
|
||||||
} else if (leading === ':') {
|
} else if (leading === ':') {
|
||||||
// shortcode
|
// shortcode
|
||||||
let allShortcodes = Object.keys(emojione.emojioneList);
|
if (!allShortcodes) {
|
||||||
|
allShortcodes = Object.keys(emojione.emojioneList);
|
||||||
// TODO when we have custom emojons merged, add them to this shortcode list
|
// TODO when we have custom emojons merged, add them to this shortcode list
|
||||||
|
}
|
||||||
return (dispatch) => {
|
return (dispatch) => {
|
||||||
dispatch(readyComposeSuggestionsTxt(token, allShortcodes.filter((sc) => {
|
dispatch(readyComposeSuggestionsTxt(token, allShortcodes.filter((sc) => {
|
||||||
return sc.indexOf(token) === 0;
|
return sc.indexOf(token) === 0;
|
||||||
|
|
Loading…
Reference in New Issue