mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-08 08:04:25 +00:00
fix(frontend): Fix how new items are processed in App select (#4109)
* fix(frontend): Fix how new items are procesed * fix(frontend): Fix regex Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * fix(frontend): avoid duplicates * fix(frontend): simplify code --------- Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
ellipsis-dev[bot]
parent
bc94acb378
commit
71badb959d
@@ -164,14 +164,23 @@
|
||||
|
||||
let css = initCss($app.css?.selectcomponent, customCss)
|
||||
|
||||
let previsousFilter = ''
|
||||
|
||||
function handleFilter(e) {
|
||||
if (resolvedConfig.create) {
|
||||
if (e.detail.length === 0 && filterText.length > 0) {
|
||||
const prev = listItems.filter((i) => !i.created)
|
||||
listItems = [
|
||||
...prev,
|
||||
{ value: JSON.stringify(filterText), label: filterText, created: true }
|
||||
]
|
||||
if (resolvedConfig.create && filterText !== previsousFilter) {
|
||||
previsousFilter = filterText
|
||||
if (filterText.length > 0) {
|
||||
const prev = listItems?.filter((i) => !i.created)
|
||||
|
||||
const exists = listItems?.some(
|
||||
(item) => item.label.toLowerCase() === filterText.toLowerCase()
|
||||
)
|
||||
if (!exists) {
|
||||
listItems = [
|
||||
...prev,
|
||||
{ value: JSON.stringify(filterText), label: filterText, created: true }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user