diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-10-05 21:10:52 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-05 21:10:52 -0400 |
commit | 0cfaa1a5a8dbe7c1c14ac17e40be1d547c1cd8a1 (patch) | |
tree | 921996ae2162ff5ee6da2fa4c2693b483ee82e51 | |
parent | 8c8c27001e441a957da331a29bc1a5de4950bf7e (diff) |
Dictionary definition structure fixes (#888)
* Restore support for tags without metadata
* Fix missing spread
-rw-r--r-- | ext/bg/js/translator.js | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js index 40fa423b..1b2bd738 100644 --- a/ext/bg/js/translator.js +++ b/ext/bg/js/translator.js @@ -446,7 +446,7 @@ class Translator { this._addUniqueTermInfos(relatedDefinitions, termInfoMap); let secondaryDefinitions = await this._getMergedSecondarySearchResults(termInfoMap, secondarySearchDictionaryMap); - secondaryDefinitions = [unsequencedDefinitions, ...secondaryDefinitions]; + secondaryDefinitions = [...unsequencedDefinitions, ...secondaryDefinitions]; this._removeUsedDefinitions(secondaryDefinitions, termInfoMap, usedDefinitions); this._removeDuplicateDefinitions(secondaryDefinitions); @@ -721,9 +721,8 @@ class Translator { const results = []; for (let i = 0, ii = tagMetaList.length; i < ii; ++i) { const meta = tagMetaList[i]; - if (meta === null) { continue; } const name = names[i]; - const {category, notes, order, score, dictionary} = meta; + const {category, notes, order, score, dictionary} = (meta !== null ? meta : {dictionary: title}); const tag = this._createTag(name, category, notes, order, score, dictionary); results.push(tag); } |