mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-18 21:55:24 +02:00
refactor: simplify useEffect dependencies in AddCommand and ShowCustomCommand components
- Updated the useEffect hooks to remove unnecessary dependencies, improving performance and readability. - Ensured that the form resets correctly based on the presence of data.
This commit is contained in:
@@ -66,19 +66,13 @@ export const AddCommand = ({ applicationId }: Props) => {
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (data?.command) {
|
||||
if (data) {
|
||||
form.reset({
|
||||
command: data?.command || "",
|
||||
args: data?.args?.map((arg) => ({ value: arg })) || [],
|
||||
});
|
||||
}
|
||||
}, [
|
||||
form,
|
||||
form.reset,
|
||||
form.formState.isSubmitSuccessful,
|
||||
data?.command,
|
||||
data?.args,
|
||||
]);
|
||||
}, [data, form]);
|
||||
|
||||
const onSubmit = async (data: AddCommand) => {
|
||||
await mutateAsync({
|
||||
|
||||
@@ -87,7 +87,7 @@ export const ShowCustomCommand = ({ id, type }: Props) => {
|
||||
args: data.args?.map((arg) => ({ value: arg })) || [],
|
||||
});
|
||||
}
|
||||
}, [data, form, form.reset]);
|
||||
}, [data, form]);
|
||||
|
||||
const onSubmit = async (formData: AddDockerImage) => {
|
||||
await mutateAsync({
|
||||
|
||||
Reference in New Issue
Block a user