mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 13:28:27 +00:00
fix secret rollback not tainting form
This commit is contained in:
+31
-12
@@ -94,8 +94,9 @@ export const SecretDetailSidebar = ({
|
|||||||
secretPath,
|
secretPath,
|
||||||
handleSecretShare
|
handleSecretShare
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
|
if (!secret) return <></>;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
register,
|
|
||||||
control,
|
control,
|
||||||
watch,
|
watch,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
@@ -103,10 +104,15 @@ export const SecretDetailSidebar = ({
|
|||||||
reset,
|
reset,
|
||||||
formState: { isDirty, isSubmitting }
|
formState: { isDirty, isSubmitting }
|
||||||
} = useForm<TFormSchema>({
|
} = useForm<TFormSchema>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema)
|
||||||
values: secret
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (secret) {
|
||||||
|
reset(secret);
|
||||||
|
}
|
||||||
|
}, [secret, reset]);
|
||||||
|
|
||||||
const { handlePopUpToggle, popUp, handlePopUpOpen } = usePopUp([
|
const { handlePopUpToggle, popUp, handlePopUpOpen } = usePopUp([
|
||||||
"secretAccessUpgradePlan"
|
"secretAccessUpgradePlan"
|
||||||
] as const);
|
] as const);
|
||||||
@@ -713,14 +719,25 @@ export const SecretDetailSidebar = ({
|
|||||||
</FormControl>
|
</FormControl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<FormControl label="Comments & Notes">
|
<Controller
|
||||||
<TextArea
|
control={control}
|
||||||
className="border border-mineshaft-600 bg-bunker-800 text-sm"
|
name="comment"
|
||||||
{...register("comment")}
|
render={({ field, fieldState: { error } }) => (
|
||||||
readOnly={isReadOnly}
|
<FormControl
|
||||||
rows={5}
|
label="Comments & Notes"
|
||||||
/>
|
isError={Boolean(error?.message)}
|
||||||
</FormControl>
|
errorText={error?.message}
|
||||||
|
className="mb-0"
|
||||||
|
>
|
||||||
|
<TextArea
|
||||||
|
className="border border-mineshaft-600 bg-bunker-800 text-sm"
|
||||||
|
readOnly={isReadOnly}
|
||||||
|
rows={5}
|
||||||
|
{...field}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
{secretReminderRepeatDays && secretReminderRepeatDays > 0 ? (
|
{secretReminderRepeatDays && secretReminderRepeatDays > 0 ? (
|
||||||
<div className="flex items-center justify-between px-2">
|
<div className="flex items-center justify-between px-2">
|
||||||
@@ -921,7 +938,9 @@ export const SecretDetailSidebar = ({
|
|||||||
variant="outline_bg"
|
variant="outline_bg"
|
||||||
size="sm"
|
size="sm"
|
||||||
className="h-8 w-8 rounded-md"
|
className="h-8 w-8 rounded-md"
|
||||||
onClick={() => setValue("value", secretValue)}
|
onClick={() =>
|
||||||
|
setValue("value", secretValue, { shouldDirty: true })
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon icon={faArrowRotateRight} />
|
<FontAwesomeIcon icon={faArrowRotateRight} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|||||||
Reference in New Issue
Block a user