Closed VigilioYonatan closed 9 months ago
I found a solution.
const settingsUpdateform = useForm<YourInterface>({
resolver: (values, ...args) => {
const defaultValues = Object.fromEntries(
Object.entries(values).filter(([k, v]) => {
return (
informationSchema.entries[
k as keyof YourInterface
].type !== "optional" || v
);
})
) as YourInterface;
return valibotResolver(informationSchema)(
defaultValues,
...args
);
},
});
Filter the optional object until the values have something
if you want to add it in other version it will be ok. THANKS OF LOT
https://codesandbox.io/p/sandbox/headless-meadow-g9l2r7?file=%2Fsrc%2FApp.tsx%3A17%2C1
Version Number
7.48.2
Codesandbox/Expo snack
https://codesandbox.io/p/sandbox/headless-meadow-g9l2r7?file=%2Fsrc%2FApp.tsx%3A1%2C1
Steps to reproduce
optional not found in Valibot - @hookform/resolvers.
dependencies: "valibot": "^0.20.1", "react-hook-form": "^7.48.2", "@hookform/resolvers": "^3.3.2",
Expected behaviour
What browsers are you seeing the problem on?
Chrome
Relevant log output
No response
Code of Conduct