Compare commits

...

2 Commits

Author SHA1 Message Date
GuoQing Liu
6f2e6c4cb2
Fix if search word is number will be crash (#19426)
* fix: fix if filterValues is number will be crash

* chore: use String function cover filterValues
2025-08-08 09:22:08 -06:00
Josh Hawkins
84f48ee3eb
Ensure arrayKeys remains a stable array reference (#19428)
fixes infinite loop and react crash from changes in #19406
2025-08-08 05:54:03 -06:00
2 changed files with 13 additions and 10 deletions

6
web/src/components/input/InputWithTags.tsx Normal file → Executable file
View File

@ -420,11 +420,11 @@ export default function InputWithTags({
? t("button.yes", { ns: "common" })
: t("button.no", { ns: "common" });
} else if (filterType === "labels") {
return getTranslatedLabel(filterValues as string);
return getTranslatedLabel(String(filterValues));
} else if (filterType === "search_type") {
return t("filter.searchType." + (filterValues as string));
return t("filter.searchType." + String(filterValues));
} else {
return (filterValues as string).replaceAll("_", " ");
return String(filterValues).replaceAll("_", " ");
}
}

View File

@ -26,6 +26,15 @@ import { useDocDomain } from "@/hooks/use-doc-domain";
const API_LIMIT = 25;
// always parse these as string arrays
const SEARCH_FILTER_ARRAY_KEYS = [
"cameras",
"labels",
"sub_labels",
"recognized_license_plate",
"zones",
];
export default function Explore() {
// search field handler
@ -58,13 +67,7 @@ export default function Explore() {
const [search, setSearch] = useState("");
const [searchFilter, setSearchFilter, searchSearchParams] =
useApiFilterArgs<SearchFilter>([
"cameras",
"labels",
"sub_labels",
"recognized_license_plate",
"zones",
]);
useApiFilterArgs<SearchFilter>(SEARCH_FILTER_ARRAY_KEYS);
const searchTerm = useMemo(
() => searchSearchParams?.["query"] || "",