mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-29 13:14:45 +02:00
Fix task edit modal not filling the payload correctly
This commit is contained in:
parent
c58348735d
commit
a966613890
@ -32,11 +32,16 @@ interface Values {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const TaskDetailsForm = ({ isEditingTask }: { isEditingTask: boolean }) => {
|
const TaskDetailsForm = ({ isEditingTask }: { isEditingTask: boolean }) => {
|
||||||
const { values: { action }, setFieldValue, setFieldTouched, isSubmitting } = useFormikContext<Values>();
|
const { values: { action }, initialValues, setFieldValue, setFieldTouched, isSubmitting } = useFormikContext<Values>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setFieldValue('payload', action === 'power' ? 'start' : '');
|
if (action !== initialValues.action) {
|
||||||
setFieldTouched('payload', false);
|
setFieldValue('payload', action === 'power' ? 'start' : '');
|
||||||
|
setFieldTouched('payload', false);
|
||||||
|
} else {
|
||||||
|
setFieldValue('payload', initialValues.payload);
|
||||||
|
setFieldTouched('payload', false);
|
||||||
|
}
|
||||||
}, [ action ]);
|
}, [ action ]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user