react-hook-form / resolvers

📋 Validation resolvers: Yup, Zod, Superstruct, Joi, Vest, Class Validator, io-ts, Nope, computed-types, typanion, Ajv, TypeBox, ArkType, Valibot, effect-ts and VineJS
https://react-hook-form.com/
MIT License
1.67k stars 151 forks source link

Issue with Resolvers tranform #662

Closed jmtwr closed 4 months ago

jmtwr commented 4 months ago

Hi, I found one annoying, some time ago the next feature was broken.

PROBLEM:

  1. describing schema validation w/ transform function > most common usage it's trim string input
  2. Trigger validation
  3. Expected to get string without spaces at the end & start of string
  4. The Result > value still with spaces

CODE SANDBOX EXAMPLE > https://codesandbox.io/p/sandbox/react-hook-forms-resolvers-issue-mpyd39?file=%2Fsrc%2FApp.tsx%3A7%2C26

POSSIBLE SOLUTION Add few lines of code into createFormControl file image

Perhaps there is a more graceful solution to this problem. Thanks!