chrore(webui): don't add duplicates to datalists
All checks were successful
Build / build (18) (push) Successful in 46s
Build / build (20) (push) Successful in 1m17s
Build / build (22) (push) Successful in 1m10s
Build / build (18) (pull_request) Successful in 45s
Build / build (20) (pull_request) Successful in 1m17s
Build / build (22) (pull_request) Successful in 1m11s
All checks were successful
Build / build (18) (push) Successful in 46s
Build / build (20) (push) Successful in 1m17s
Build / build (22) (push) Successful in 1m10s
Build / build (18) (pull_request) Successful in 45s
Build / build (20) (pull_request) Successful in 1m17s
Build / build (22) (pull_request) Successful in 1m11s
Browsers will show all options, even if this makes no sense, causing some confusion for users.
This commit is contained in:
parent
8ce86ad4fd
commit
687e614320
@ -260,6 +260,7 @@ function fetchItemList() {
|
||||
} else if (type == "uniqueLevelCaps") {
|
||||
uniqueLevelCaps = items;
|
||||
} else {
|
||||
const nameSet = new Set();
|
||||
items.forEach(item => {
|
||||
if (item.name.includes("<ARCHWING> ")) {
|
||||
item.name = item.name.replace("<ARCHWING> ", "");
|
||||
@ -306,20 +307,19 @@ function fetchItemList() {
|
||||
document
|
||||
.getElementById("datalist-" + type + "-" + item.partType.slice(5))
|
||||
.appendChild(option);
|
||||
}
|
||||
} else if (item.badReason != "notraw") {
|
||||
if (nameSet.has(item.name)) {
|
||||
//console.log(`Not adding ${item.uniqueName} to datalist for ${type} due to duplicate display name: ${item.name}`);
|
||||
} else {
|
||||
console.log(item.partType);
|
||||
nameSet.add(item.name);
|
||||
|
||||
const option = document.createElement("option");
|
||||
option.setAttribute("data-key", item.uniqueName);
|
||||
option.value = item.name;
|
||||
document.getElementById("datalist-" + type).appendChild(option);
|
||||
}
|
||||
}
|
||||
if (item.badReason != "notraw") {
|
||||
const option = document.createElement("option");
|
||||
option.setAttribute("data-key", item.uniqueName);
|
||||
option.value = item.name;
|
||||
document.getElementById("datalist-" + type).appendChild(option);
|
||||
}
|
||||
itemMap[item.uniqueName] = { ...item, type };
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user