diff --git a/package.json b/package.json index 2237e2b60..817820f4e 100644 --- a/package.json +++ b/package.json @@ -155,7 +155,7 @@ "imagesloaded": "^4.1.4", "json-loader": "^0.5.4", "lbry-format": "https://github.com/lbryio/lbry-format.git", - "lbry-redux": "lbryio/lbry-redux#49b9db5aae8db84ec21231444bf8345d450812b2", + "lbry-redux": "lbryio/lbry-redux#372e559caee6af2b2d927e5d42419a71c3d15b57", "lbryinc": "lbryio/lbryinc#0b4e41ef90d6347819dd3453f2f9398a5c1b4f36", "lint-staged": "^7.0.2", "localforage": "^1.7.1", diff --git a/ui/component/collectionEdit/view.jsx b/ui/component/collectionEdit/view.jsx index 8c7b50716..fbb3794aa 100644 --- a/ui/component/collectionEdit/view.jsx +++ b/ui/component/collectionEdit/view.jsx @@ -117,6 +117,28 @@ function CollectionForm(props: Props) { setParams({ ...params, ...paramObj }); } + // TODO remove this or better decide whether app should delete languages[2+] + // This was added because a previous update setting was duplicating language codes + function dedupeLanguages(languages) { + if (languages.length <= 1) { + return languages; + } else if (languages.length === 2) { + if (languages[0] !== languages[1]) { + return languages; + } else { + return [languages[0]]; + } + } else if (languages.length > 2) { + const newLangs = []; + languages.forEach((l) => { + if (!newLangs.includes(l)) { + newLangs.push(l); + } + }); + return newLangs; + } + } + function getCollectionParams() { const collectionParams: { thumbnail_url?: string, @@ -134,7 +156,7 @@ function CollectionForm(props: Props) { thumbnail_url: thumbnailUrl, description, bid: String(amount || 0.001), - languages: languages || [], + languages: languages ? dedupeLanguages(languages) : [], locations: locations || [], tags: tags ? tags.map((tag) => { @@ -175,6 +197,9 @@ function CollectionForm(props: Props) { langs = []; } else { langs[0] = code; + if (langs[0] === langs[1]) { + langs.length = 1; + } } } else { if (code === LANG_NONE || code === langs[0]) { diff --git a/yarn.lock b/yarn.lock index e656a4af5..415c39554 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10139,9 +10139,9 @@ lazy-val@^1.0.4: yargs "^13.2.2" zstd-codec "^0.1.1" -lbry-redux@lbryio/lbry-redux#49b9db5aae8db84ec21231444bf8345d450812b2: +lbry-redux@lbryio/lbry-redux#372e559caee6af2b2d927e5d42419a71c3d15b57: version "0.0.1" - resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/49b9db5aae8db84ec21231444bf8345d450812b2" + resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/372e559caee6af2b2d927e5d42419a71c3d15b57" dependencies: "@ungap/from-entries" "^0.2.1" proxy-polyfill "0.1.6"