Fix can't submit build without description

This commit is contained in:
Kalle
2026-01-21 18:15:26 +02:00
parent 49ea49a30b
commit 1ffccd70de
3 changed files with 5 additions and 4 deletions

View File

@@ -77,7 +77,7 @@ function resolveDefaultValues(
buildToEdit?.shoesGearSplId === -1 ? null : buildToEdit?.shoesGearSplId,
abilities,
title: buildToEdit?.title,
description: buildToEdit?.description,
description: buildToEdit?.description ?? null,
modes: buildToEdit?.modes ?? [],
private: Boolean(buildToEdit?.private),
};

View File

@@ -389,8 +389,9 @@ function buildInitialValues<T extends z.ZodRawShape>(
| FormField
| undefined;
if (defaultValues && key in defaultValues) {
result[key] = defaultValues[key as keyof typeof defaultValues];
const defaultValue = defaultValues?.[key as keyof typeof defaultValues];
if (defaultValue !== undefined) {
result[key] = defaultValue;
} else if (formField) {
result[key] = formField.initialValue;
}

View File

@@ -192,7 +192,7 @@ export const safeNullableStringSchema = ({
max: number;
}) =>
z.preprocess(
actuallyNonEmptyStringOrNull,
processMany(undefinedToNull, actuallyNonEmptyStringOrNull),
z
.string()
.min(min ?? 0)