From 8e1fd4474f94fc8562a577f731ef70e953e39b29 Mon Sep 17 00:00:00 2001 From: miloschwartz Date: Wed, 14 Jan 2026 22:08:16 -0800 Subject: [PATCH] fix whitelist hyrdration closes #2190 --- .../proxy/[niceId]/authentication/page.tsx | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/app/[orgId]/settings/resources/proxy/[niceId]/authentication/page.tsx b/src/app/[orgId]/settings/resources/proxy/[niceId]/authentication/page.tsx index 968b2700..a7224461 100644 --- a/src/app/[orgId]/settings/resources/proxy/[niceId]/authentication/page.tsx +++ b/src/app/[orgId]/settings/resources/proxy/[niceId]/authentication/page.tsx @@ -767,6 +767,8 @@ export default function ResourceAuthenticationPage() { @@ -776,11 +778,16 @@ export default function ResourceAuthenticationPage() { type OneTimePasswordFormSectionProps = Pick< ResourceContextType, "resource" | "updateResource" ->; +> & { + whitelist: Array<{ email: string }>; + isLoadingWhiteList: boolean; +}; function OneTimePasswordFormSection({ resource, - updateResource + updateResource, + whitelist, + isLoadingWhiteList }: OneTimePasswordFormSectionProps) { const { env } = useEnvContext(); const [whitelistEnabled, setWhitelistEnabled] = useState( @@ -801,6 +808,18 @@ function OneTimePasswordFormSection({ number | null >(null); + useEffect(() => { + if (isLoadingWhiteList) return; + + whitelistForm.setValue( + "emails", + whitelist.map((w) => ({ + id: w.email, + text: w.email + })) + ); + }, [isLoadingWhiteList, whitelist, whitelistForm]); + async function saveWhitelist() { try { await api.post(`/resource/${resource.resourceId}`, {