diff --git a/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/endpoint-spec-form.tsx b/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/endpoint-spec-form.tsx index 9bd6735c3..7ee31e5b6 100644 --- a/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/endpoint-spec-form.tsx +++ b/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/endpoint-spec-form.tsx @@ -82,7 +82,10 @@ export const EndpointSpecForm = ({ id, type }: EndpointSpecFormProps) => { setIsLoading(true); try { // Check if all values are empty, if so, send null to clear the database - const hasAnyValue = formData.Mode !== undefined && formData.Mode !== null && formData.Mode !== ""; + const hasAnyValue = + formData.Mode !== undefined && + formData.Mode !== null && + formData.Mode !== ""; await mutateAsync({ applicationId: id || "", diff --git a/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/health-check-form.tsx b/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/health-check-form.tsx index 378be5dbb..b2fc49ef3 100644 --- a/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/health-check-form.tsx +++ b/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/health-check-form.tsx @@ -90,7 +90,7 @@ export const HealthCheckForm = ({ id, type }: HealthCheckFormProps) => { setIsLoading(true); try { // Check if all values are empty, if so, send null to clear the database - const hasAnyValue = + const hasAnyValue = (formData.Test && formData.Test.length > 0) || formData.Interval !== undefined || formData.Timeout !== undefined || diff --git a/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/placement-form.tsx b/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/placement-form.tsx index 7c2ef074c..b0c354513 100644 --- a/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/placement-form.tsx +++ b/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/placement-form.tsx @@ -103,7 +103,7 @@ export const PlacementForm = ({ id, type }: PlacementFormProps) => { setIsLoading(true); try { // Check if all values are empty, if so, send null to clear the database - const hasAnyValue = + const hasAnyValue = (formData.Constraints && formData.Constraints.length > 0) || (formData.Preferences && formData.Preferences.length > 0) || (formData.Platforms && formData.Platforms.length > 0) || diff --git a/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/restart-policy-form.tsx b/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/restart-policy-form.tsx index 395855231..b7fb649be 100644 --- a/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/restart-policy-form.tsx +++ b/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/restart-policy-form.tsx @@ -94,7 +94,7 @@ export const RestartPolicyForm = ({ id, type }: RestartPolicyFormProps) => { try { // Check if all values are empty, if so, send null to clear the database const hasAnyValue = Object.values(formData).some( - value => value !== undefined && value !== null && value !== "" + (value) => value !== undefined && value !== null && value !== "", ); await mutateAsync({ diff --git a/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/rollback-config-form.tsx b/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/rollback-config-form.tsx index 3f298a7e8..c9c6ad128 100644 --- a/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/rollback-config-form.tsx +++ b/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/rollback-config-form.tsx @@ -93,7 +93,7 @@ export const RollbackConfigForm = ({ id, type }: RollbackConfigFormProps) => { try { // Check if all values are empty, if so, send null to clear the database const hasAnyValue = Object.values(formData).some( - value => value !== undefined && value !== null && value !== "" + (value) => value !== undefined && value !== null && value !== "", ); await mutateAsync({ diff --git a/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/stop-grace-period-form.tsx b/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/stop-grace-period-form.tsx index 30194557b..a324da31b 100644 --- a/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/stop-grace-period-form.tsx +++ b/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/stop-grace-period-form.tsx @@ -119,9 +119,15 @@ export const StopGracePeriodForm = ({ id, type }: StopGracePeriodFormProps) => { type="number" placeholder="30000000000" {...field} - value={field?.value !== null && field?.value !== undefined ? field.value.toString() : ""} + value={ + field?.value !== null && field?.value !== undefined + ? field.value.toString() + : "" + } onChange={(e) => - field.onChange(e.target.value ? BigInt(e.target.value) : null) + field.onChange( + e.target.value ? BigInt(e.target.value) : null, + ) } /> diff --git a/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/update-config-form.tsx b/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/update-config-form.tsx index f756e47e1..26c42adff 100644 --- a/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/update-config-form.tsx +++ b/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/update-config-form.tsx @@ -99,7 +99,7 @@ export const UpdateConfigForm = ({ id, type }: UpdateConfigFormProps) => { try { // Check if all values are empty, if so, send null to clear the database const hasAnyValue = Object.values(formData).some( - value => value !== undefined && value !== null && value !== "" + (value) => value !== undefined && value !== null && value !== "", ); await mutateAsync({ diff --git a/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/utils.ts b/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/utils.ts index b6120ec9b..58793c02e 100644 --- a/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/utils.ts +++ b/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/utils.ts @@ -2,20 +2,25 @@ * Filters out undefined, null, and empty string values from form data * Only returns fields that have actual values */ -export const filterEmptyValues = (formData: Record): Record => { - return Object.entries(formData).reduce((acc, [key, value]) => { - // Keep arrays even if empty (they might be intentionally cleared) - if (Array.isArray(value)) { - if (value.length > 0) { +export const filterEmptyValues = ( + formData: Record, +): Record => { + return Object.entries(formData).reduce( + (acc, [key, value]) => { + // Keep arrays even if empty (they might be intentionally cleared) + if (Array.isArray(value)) { + if (value.length > 0) { + acc[key] = value; + } + } + // For other values, filter out undefined, null, and empty strings + else if (value !== undefined && value !== null && value !== "") { acc[key] = value; } - } - // For other values, filter out undefined, null, and empty strings - else if (value !== undefined && value !== null && value !== "") { - acc[key] = value; - } - return acc; - }, {} as Record); + return acc; + }, + {} as Record, + ); }; /**