From 93fe9929b7dc32f0a953bd50f639657f810294de Mon Sep 17 00:00:00 2001 From: x032205 Date: Mon, 19 May 2025 15:22:24 -0400 Subject: [PATCH 1/2] fix secret rollback not tainting form --- .../SecretListView/SecretDetailSidebar.tsx | 43 +++++++++++++------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx index 8eb55b81e..ff98653f7 100644 --- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx +++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx @@ -94,8 +94,9 @@ export const SecretDetailSidebar = ({ secretPath, handleSecretShare }: Props) => { + if (!secret) return <>; + const { - register, control, watch, handleSubmit, @@ -103,10 +104,15 @@ export const SecretDetailSidebar = ({ reset, formState: { isDirty, isSubmitting } } = useForm({ - resolver: zodResolver(formSchema), - values: secret + resolver: zodResolver(formSchema) }); + useEffect(() => { + if (secret) { + reset(secret); + } + }, [secret, reset]); + const { handlePopUpToggle, popUp, handlePopUpOpen } = usePopUp([ "secretAccessUpgradePlan" ] as const); @@ -713,14 +719,25 @@ export const SecretDetailSidebar = ({ - -