From 75a49790ea27912bce2efffe894889119210397b Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Sun, 30 Nov 2025 19:07:59 -0600 Subject: [PATCH] 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. --- .../application/advanced/general/add-command.tsx | 10 ++-------- .../postgres/advanced/show-custom-command.tsx | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/apps/dokploy/components/dashboard/application/advanced/general/add-command.tsx b/apps/dokploy/components/dashboard/application/advanced/general/add-command.tsx index e57f21895..a7c5f7288 100644 --- a/apps/dokploy/components/dashboard/application/advanced/general/add-command.tsx +++ b/apps/dokploy/components/dashboard/application/advanced/general/add-command.tsx @@ -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({ diff --git a/apps/dokploy/components/dashboard/postgres/advanced/show-custom-command.tsx b/apps/dokploy/components/dashboard/postgres/advanced/show-custom-command.tsx index 934716b19..5a543b477 100644 --- a/apps/dokploy/components/dashboard/postgres/advanced/show-custom-command.tsx +++ b/apps/dokploy/components/dashboard/postgres/advanced/show-custom-command.tsx @@ -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({