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,
};
// Convert recent emoji characters to emoji data, removing unknowns.
this.recentlyUsed = recent.get()
// Convert recent emoji characters to emoji data, removing unknowns and duplicates
this.recentlyUsed = Array.from(new Set(recent.get()
.map(unicode => getEmojiFromUnicode(unicode))
.filter(data => !!data);
.filter(data => !!data)));
this.memoizedDataByCategory = {
recent: this.recentlyUsed,
...DATA_BY_CATEGORY,