From e6e44074dd14b734573d24b9b09b0f7c88ce478f Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 29 Apr 2026 14:49:29 +0000 Subject: [PATCH 1/2] Sync client filters with URL query parameter Auto-select feature filters on the clients page from a `?filter=` query parameter, and update the URL in place when filters change. Filter values are validated against the known FEATURES whitelist, so unknown or malicious values are ignored. --- docs/clients.mdx | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/docs/clients.mdx b/docs/clients.mdx index 0f4065025..5c685b0eb 100644 --- a/docs/clients.mdx +++ b/docs/clients.mdx @@ -85,9 +85,28 @@ export const ClientFilter = () => { const { selectedFeatures, searchText, visibleCount, totalCount } = useFilterStore(); useEffect(() => { - filterStore.setState({ selectedFeatures: [], searchText: "" }); + let initialFeatures = []; + if (typeof window !== "undefined") { + const filterParam = new URLSearchParams(window.location.search).get("filter"); + if (filterParam) { + const requested = new Set(filterParam.split(",").map(f => f.trim())); + initialFeatures = FEATURES.filter(f => requested.has(f)); + } + } + filterStore.setState({ selectedFeatures: initialFeatures, searchText: "" }); }, []); + useEffect(() => { + if (typeof window === "undefined") return; + const url = new URL(window.location.href); + if (selectedFeatures.length > 0) { + url.searchParams.set("filter", selectedFeatures.join(",")); + } else { + url.searchParams.delete("filter"); + } + window.history.replaceState({}, "", url); + }, [selectedFeatures]); + const toggleFeature = (feature) => { const newFeatures = selectedFeatures.includes(feature) ? selectedFeatures.filter(f => f !== feature) From 5880396ebdd333d30871ed6994a1af96f2ff05f4 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 29 Apr 2026 15:01:52 +0000 Subject: [PATCH 2/2] Use literal commas in clients filter URL --- docs/clients.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/clients.mdx b/docs/clients.mdx index 5c685b0eb..b39462446 100644 --- a/docs/clients.mdx +++ b/docs/clients.mdx @@ -99,10 +99,10 @@ export const ClientFilter = () => { useEffect(() => { if (typeof window === "undefined") return; const url = new URL(window.location.href); + url.searchParams.delete("filter"); if (selectedFeatures.length > 0) { - url.searchParams.set("filter", selectedFeatures.join(",")); - } else { - url.searchParams.delete("filter"); + const value = selectedFeatures.map(encodeURIComponent).join(","); + url.search = url.search ? `${url.search}&filter=${value}` : `?filter=${value}`; } window.history.replaceState({}, "", url); }, [selectedFeatures]);