Deduplicate recent emoji

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2020-01-05 21:23:34 +00:00
parent 65954b1e1b
commit cf071c5ac6

View file

@ -47,10 +47,10 @@ class EmojiPicker extends React.Component {
viewportHeight: 280, viewportHeight: 280,
}; };
// Convert recent emoji characters to emoji data, removing unknowns. // Convert recent emoji characters to emoji data, removing unknowns and duplicates
this.recentlyUsed = recent.get() this.recentlyUsed = Array.from(new Set(recent.get()
.map(unicode => getEmojiFromUnicode(unicode)) .map(unicode => getEmojiFromUnicode(unicode))
.filter(data => !!data); .filter(data => !!data)));
this.memoizedDataByCategory = { this.memoizedDataByCategory = {
recent: this.recentlyUsed, recent: this.recentlyUsed,
...DATA_BY_CATEGORY, ...DATA_BY_CATEGORY,