Skip to content

Commit c045ea9

Browse files
committed
feat(editor2): use title as fallback for details
1 parent ba92c07 commit c045ea9

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/components/editor2/validation/schema.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,16 @@ const doc = z.looseObject({
2828
details_color: z.string().optional(),
2929
})
3030

31-
const docStrict = doc.extend({
32-
title: doc.shape.title.unwrap().min(1),
33-
})
31+
const docStrict = doc
32+
.extend({
33+
title: doc.shape.title.unwrap().min(1),
34+
})
35+
.transform((doc) => ({
36+
...doc,
37+
// the backend requires details to be non-empty, but we don't want to
38+
// force the user to fill it in, so we use title as a fallback
39+
details: doc.details || doc.title,
40+
}))
3441

3542
const operator_requirements = z.looseObject({
3643
elite: z.number().int().min(0).max(2).optional(),

0 commit comments

Comments
 (0)