moved it outside

This commit is contained in:
hagen-danswer
2024-11-22 14:59:58 -08:00
parent 3e58f9f8ab
commit e32809f7ca

View File

@@ -24,7 +24,14 @@ export const SlackTokensForm = ({
setPopup: (popup: { message: string; type: "error" | "success" }) => void;
router: any;
onValuesChange?: (values: any) => void;
}) => (
}) => {
useEffect(() => {
if (onValuesChange) {
onValuesChange(initialValues);
}
}, [initialValues]);
return (
<Formik
initialValues={initialValues}
validationSchema={Yup.object().shape({
@@ -68,12 +75,7 @@ export const SlackTokensForm = ({
}}
enableReinitialize={true}
>
{({ isSubmitting, setFieldValue, values }) => {
useEffect(() => {
onValuesChange?.(values);
}, [values, onValuesChange]);
return (
{({ isSubmitting, setFieldValue, values }) => (
<Form className="w-full">
{!isUpdate && (
<div className="">
@@ -126,7 +128,7 @@ export const SlackTokensForm = ({
</Button>
</div>
</Form>
);
}}
)}
</Formik>
);
);
};