From 0cfaa1a5a8dbe7c1c14ac17e40be1d547c1cd8a1 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 5 Oct 2020 21:10:52 -0400 Subject: Dictionary definition structure fixes (#888) * Restore support for tags without metadata * Fix missing spread --- ext/bg/js/translator.js | 5 ++--- 1 file 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); } -- cgit v1.2.3