diff --git a/CHANGELOG.md b/CHANGELOG.md index f9d95e7..8014025 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.8.2 - 2019-01-08 + +* Fix error on missing child in menuStructure + ## 0.8.1 - 2019-01-07 * Fix scope diff --git a/package.json b/package.json index 8e314ab..eac3f9f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@deskpro/token-field", - "version": "0.8.1", + "version": "0.8.2", "description": "", "main": "dist/index.js", "private": false, diff --git a/src/Components/TokenFieldInput.jsx b/src/Components/TokenFieldInput.jsx index e3f8c7d..9ccfa44 100644 --- a/src/Components/TokenFieldInput.jsx +++ b/src/Components/TokenFieldInput.jsx @@ -539,11 +539,14 @@ export default class TokenFieldInput extends React.Component { } return true; }) - .map((child) => { + .reduce((childResult, child) => { const token = this.props.tokenTypes.find(t => t.id === child.token); + if (!token) { + return childResult; + } const childLabel = token.label ? token.label : token.id; const childSelect = (selectLevel === 1 && subSelected === child) ? styles.selected : ''; - return ( + childResult.push( this.selectToken(token)} @@ -553,7 +556,8 @@ export default class TokenFieldInput extends React.Component { {childLabel} ); - }) + return childResult; + }, []) }