mirror of
https://github.com/hanzoai/sign.git
synced 2026-10-21 01:21:51 +00:00
fix(signing): name the number field's range issues the zod 4 way
The number dialog adds too_small and too_big issues for a field's min and max without a message of its own, so zod's words are the ones shown. zod 4 reads what was measured from `origin`; the dialog still said `type`, zod 3's name, so the types refused the issue and the message read "Too small: expected undefined to be >=5". With `origin: 'number'` it reads "Too small: expected number to be >=5" and "Too big: expected number to be <=10". Before the sweep zod 3 said "Number must be greater than or equal to 5". No test here: the schema is built inside the dialog in apps/remix, which has no test runner. The strings above were measured with zod 4.6.5 and, for the last one, zod/v3. Co-authored-by: Hanzo Dev <[email protected]>
This commit is contained in:
@@ -72,7 +72,7 @@ export const SignFieldNumberDialog = createCallable<SignFieldNumberDialogProps,
|
||||
code: z.ZodIssueCode.too_small,
|
||||
minimum: minValue,
|
||||
inclusive: true,
|
||||
type: 'number',
|
||||
origin: 'number',
|
||||
});
|
||||
|
||||
return;
|
||||
@@ -83,7 +83,7 @@ export const SignFieldNumberDialog = createCallable<SignFieldNumberDialogProps,
|
||||
code: z.ZodIssueCode.too_big,
|
||||
maximum: maxValue,
|
||||
inclusive: true,
|
||||
type: 'number',
|
||||
origin: 'number',
|
||||
});
|
||||
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user