From 3a9e79e6d56740652a26fa87e29bafe676aa84ac Mon Sep 17 00:00:00 2001 From: Owen Date: Tue, 31 Mar 2026 16:17:17 -0700 Subject: [PATCH] Filter only newt sites on private resources --- src/components/InternalResourceForm.tsx | 1 + src/components/site-selector.tsx | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/InternalResourceForm.tsx b/src/components/InternalResourceForm.tsx index 50847a489..a4a793753 100644 --- a/src/components/InternalResourceForm.tsx +++ b/src/components/InternalResourceForm.tsx @@ -614,6 +614,7 @@ export function InternalResourceForm({ { setSelectedSite(site); field.onChange(site.siteId); diff --git a/src/components/site-selector.tsx b/src/components/site-selector.tsx index 4c3c97651..db23362dc 100644 --- a/src/components/site-selector.tsx +++ b/src/components/site-selector.tsx @@ -24,12 +24,14 @@ export type SitesSelectorProps = { orgId: string; selectedSite?: Selectedsite | null; onSelectSite: (selected: Selectedsite) => void; + filterTypes?: string[]; }; export function SitesSelector({ orgId, selectedSite, - onSelectSite + onSelectSite, + filterTypes }: SitesSelectorProps) { const t = useTranslations(); const [siteSearchQuery, setSiteSearchQuery] = useState(""); @@ -45,7 +47,9 @@ export function SitesSelector({ // always include the selected site in the list of sites shown const sitesShown = useMemo(() => { - const allSites: Array = [...sites]; + const allSites: Array = filterTypes + ? sites.filter((s) => filterTypes.includes(s.type)) + : [...sites]; if ( debouncedQuery.trim().length === 0 && selectedSite && @@ -54,7 +58,7 @@ export function SitesSelector({ allSites.unshift(selectedSite); } return allSites; - }, [debouncedQuery, sites, selectedSite]); + }, [debouncedQuery, sites, selectedSite, filterTypes]); return (