diff --git a/src/components/category.js b/src/components/category.js index 6dd7590..86208eb 100644 --- a/src/components/category.js +++ b/src/components/category.js @@ -2,6 +2,7 @@ import React from 'react' import PropTypes from 'prop-types' import frequently from '../utils/frequently' +import { getData } from '../utils' import { Emoji } from '.' export default class Category extends React.Component { @@ -107,7 +108,11 @@ export default class Category extends React.Component { } return id - }) + }).filter(id => !!getData(id)) + } + + if (emojis.length === 0 && frequentlyUsed.length > 0) { + return null; } } diff --git a/src/utils/index.js b/src/utils/index.js index 4a7e26a..e9f0ff3 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -78,6 +78,8 @@ function getData(emoji, skin, set) { if (data.emojis.hasOwnProperty(emoji)) { emojiData = data.emojis[emoji] + } else { + return null } } else if (emoji.id) { if (data.short_names.hasOwnProperty(emoji.id)) {