fix(webui): fix duplicate Selector options (?)
ci/woodpecker/push/woodpecker Pipeline was successful Details

refactor/sveltekit
Tomáš Mládek 2023-11-26 22:54:55 +01:00
parent 1890b29624
commit e9caac0bea
1 changed files with 9 additions and 10 deletions

View File

@ -139,7 +139,7 @@
let options: SelectorOption[] = [];
let searchResult: UpListing | undefined = undefined;
const updateOptions = debounce(async (query: string, doSearch: boolean) => {
options = [];
let result = [];
if (query.length === 0 && emptyOptions !== undefined) {
options = emptyOptions;
@ -149,7 +149,7 @@
if (types.includes("Number")) {
const number = parseFloat(query);
if (!Number.isNaN(number)) {
options.push({
result.push({
t: "Number",
c: number,
});
@ -157,7 +157,7 @@
}
if (types.includes("String") && query.length) {
options.push({
result.push({
t: "String",
c: query,
});
@ -180,14 +180,14 @@
if (exactHits.length) {
exactHits.forEach((addr) =>
options.push({
result.push({
t: "Address",
c: addr,
labels: addressToLabels[addr],
}),
);
} else if (query.length && types.includes("NewAddress")) {
options.push({
result.push({
t: "NewAddress",
c: query,
});
@ -201,7 +201,7 @@
keys: ["value.c"],
});
options.push(
result.push(
...sortedOptions.map((e) => {
return {
t: "Address",
@ -218,7 +218,7 @@
? allAttributes.filter((attr) => attributeOptions.includes(attr.name))
: allAttributes;
if (emptyOptions === undefined || query.length > 0) {
options.push(
result.push(
...attributes
.filter(
(attr) =>
@ -246,16 +246,15 @@
!allAttributes.map((attr) => attr.name).includes(attributeToCreate) &&
types.includes("NewAttribute")
) {
options.push({
result.push({
t: "NewAttribute",
name: attributeToCreate,
label: query,
});
}
options = options;
}
options = options;
options = result;
}, 200);
$: dbg("Options: %O", options);