Open
Description
I fixed just the search part in a PR I'm working on and @haraldschilly also did in his PR #7407. My fix is better since it uses much better code already in the util package instead of rewriting similar code, but I'll just merge his for now. I think Harald forgot about the search_split and search_match functions in util, which we should always use for search filter consistency. For the record, this is the conflict in packages/frontend/admin/site-settings/render-row.tsx.
...
export function RenderRow({
name,
conf,
data,
update,
isReadonly,
onChangeEntry,
onJsonEntryChange,
filterStr,
filterTag,
isModified,
isHeader,
saveSingleSetting,
}: RenderRowProps) {
if (data == null) return null;
<<<<<<< HEAD
if (filter.length > 0) {
const x = JSON.stringify(conf).toLowerCase().replace(/-/g, " ");
if (!search_match(x, filter)) {
=======
// if tags are used, we're strictly filtering by them
if (filterTag) {
if (!conf.tags) return null;
if (!conf.tags.includes(filterTag)) {
return null;
}
}
// otherwise we're (additionally) filtering by the search string
if (filterStr) {
const { tags, name: title, desc } = conf;
const f = filterStr.toLowerCase();
const match_any_tag = tags && tags.includes(f as any);
const x = [name, title, desc]
.join(" ")
.toLowerCase()
.replace(/-/g, " ")
.replace(/_/g, " ");
if (!x.includes(f) && !match_any_tag) {
>>>>>>> master
return null;
}
}
...