From b1d6de2370472500f184428bdb1dc54f3120550a Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Fri, 8 Aug 2025 06:36:49 -0500 Subject: [PATCH] Ensure arrayKeys remains a stable array reference fixes infinite loop and react crash from changes in #19406 --- web/src/pages/Explore.tsx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/web/src/pages/Explore.tsx b/web/src/pages/Explore.tsx index 9cb97ae2a..09e576551 100644 --- a/web/src/pages/Explore.tsx +++ b/web/src/pages/Explore.tsx @@ -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([ - "cameras", - "labels", - "sub_labels", - "recognized_license_plate", - "zones", - ]); + useApiFilterArgs(SEARCH_FILTER_ARRAY_KEYS); const searchTerm = useMemo( () => searchSearchParams?.["query"] || "",