From cdb43d9658c99b4923c9415b98cfb59e063e7d37 Mon Sep 17 00:00:00 2001 From: miloschwartz Date: Tue, 9 Jun 2026 14:36:50 -0700 Subject: [PATCH] dont set whitelist until click set button in dialog --- .../PolicyAuthStackSectionCreate.tsx | 25 +++++++------------ .../PolicyAuthStackSectionEdit.tsx | 23 +++++++---------- 2 files changed, 18 insertions(+), 30 deletions(-) diff --git a/src/components/resource-policy/PolicyAuthStackSectionCreate.tsx b/src/components/resource-policy/PolicyAuthStackSectionCreate.tsx index 9553d8e57..f8d02fb30 100644 --- a/src/components/resource-policy/PolicyAuthStackSectionCreate.tsx +++ b/src/components/resource-policy/PolicyAuthStackSectionCreate.tsx @@ -207,19 +207,11 @@ export function PolicyAuthStackSectionCreate({ active={Boolean(emailWhitelistEnabled)} onConfigure={() => setEditingMethod("email")} onToggle={(active) => - handleToggle( - "email", - active, - () => - parentForm.setValue( - "emailWhitelistEnabled", - false - ), - () => - parentForm.setValue( - "emailWhitelistEnabled", - true - ) + handleToggle("email", active, () => + parentForm.setValue( + "emailWhitelistEnabled", + false + ) ) } disabled={!emailEnabled} @@ -266,12 +258,13 @@ export function PolicyAuthStackSectionCreate({ onOpenChange={(open) => !open && closeCredenza()} emailEnabled={emailEnabled} emails={emails} - onSave={(value) => + onSave={(value) => { parentForm.setValue( "emails", value as PolicyFormValues["emails"] - ) - } + ); + parentForm.setValue("emailWhitelistEnabled", true); + }} /> - handleToggle( - "email", - active, - () => - form.setValue( - "emailWhitelistEnabled", - false - ), - () => - form.setValue( - "emailWhitelistEnabled", - true - ) + handleToggle("email", active, () => + form.setValue( + "emailWhitelistEnabled", + false + ) ) } disabled={authReadonly || !emailEnabled} @@ -761,7 +753,10 @@ export function PolicyAuthStackSectionEdit({ emailEnabled={emailEnabled} disabled={authReadonly} emails={emails} - onSave={(value) => form.setValue("emails", value)} + onSave={(value) => { + form.setValue("emails", value); + form.setValue("emailWhitelistEnabled", true); + }} />