[autofix.ci] apply automated fixes

This commit is contained in:
autofix-ci[bot]
2026-01-20 15:02:58 +00:00
committed by GitHub
parent a0d8eb9380
commit 7e48b2cf29
8 changed files with 34 additions and 20 deletions
@@ -82,7 +82,10 @@ export const EndpointSpecForm = ({ id, type }: EndpointSpecFormProps) => {
setIsLoading(true); setIsLoading(true);
try { try {
// Check if all values are empty, if so, send null to clear the database // 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({ await mutateAsync({
applicationId: id || "", applicationId: id || "",
@@ -94,7 +94,7 @@ export const RestartPolicyForm = ({ id, type }: RestartPolicyFormProps) => {
try { try {
// Check if all values are empty, if so, send null to clear the database // Check if all values are empty, if so, send null to clear the database
const hasAnyValue = Object.values(formData).some( const hasAnyValue = Object.values(formData).some(
value => value !== undefined && value !== null && value !== "" (value) => value !== undefined && value !== null && value !== "",
); );
await mutateAsync({ await mutateAsync({
@@ -93,7 +93,7 @@ export const RollbackConfigForm = ({ id, type }: RollbackConfigFormProps) => {
try { try {
// Check if all values are empty, if so, send null to clear the database // Check if all values are empty, if so, send null to clear the database
const hasAnyValue = Object.values(formData).some( const hasAnyValue = Object.values(formData).some(
value => value !== undefined && value !== null && value !== "" (value) => value !== undefined && value !== null && value !== "",
); );
await mutateAsync({ await mutateAsync({
@@ -119,9 +119,15 @@ export const StopGracePeriodForm = ({ id, type }: StopGracePeriodFormProps) => {
type="number" type="number"
placeholder="30000000000" placeholder="30000000000"
{...field} {...field}
value={field?.value !== null && field?.value !== undefined ? field.value.toString() : ""} value={
field?.value !== null && field?.value !== undefined
? field.value.toString()
: ""
}
onChange={(e) => onChange={(e) =>
field.onChange(e.target.value ? BigInt(e.target.value) : null) field.onChange(
e.target.value ? BigInt(e.target.value) : null,
)
} }
/> />
</FormControl> </FormControl>
@@ -99,7 +99,7 @@ export const UpdateConfigForm = ({ id, type }: UpdateConfigFormProps) => {
try { try {
// Check if all values are empty, if so, send null to clear the database // Check if all values are empty, if so, send null to clear the database
const hasAnyValue = Object.values(formData).some( const hasAnyValue = Object.values(formData).some(
value => value !== undefined && value !== null && value !== "" (value) => value !== undefined && value !== null && value !== "",
); );
await mutateAsync({ await mutateAsync({
@@ -2,8 +2,11 @@
* Filters out undefined, null, and empty string values from form data * Filters out undefined, null, and empty string values from form data
* Only returns fields that have actual values * Only returns fields that have actual values
*/ */
export const filterEmptyValues = (formData: Record<string, any>): Record<string, any> => { export const filterEmptyValues = (
return Object.entries(formData).reduce((acc, [key, value]) => { formData: Record<string, any>,
): Record<string, any> => {
return Object.entries(formData).reduce(
(acc, [key, value]) => {
// Keep arrays even if empty (they might be intentionally cleared) // Keep arrays even if empty (they might be intentionally cleared)
if (Array.isArray(value)) { if (Array.isArray(value)) {
if (value.length > 0) { if (value.length > 0) {
@@ -15,7 +18,9 @@ export const filterEmptyValues = (formData: Record<string, any>): Record<string,
acc[key] = value; acc[key] = value;
} }
return acc; return acc;
}, {} as Record<string, any>); },
{} as Record<string, any>,
);
}; };
/** /**